View | Details | Raw Unified | Return to bug 9149
Collapse All | Expand All

(-)a/C4/AuthoritiesMarc.pm (-1 / +63 lines)
Lines 1144-1149 sub BuildSummary { Link Here
1144
    return \%summary;
1144
    return \%summary;
1145
}
1145
}
1146
1146
1147
=head2 GetAuthorizedHeading
1148
1149
  $heading = &GetAuthorizedHeading({ record => $record, authid => $authid })
1150
1151
Takes a MARC::Record object describing an authority record or an authid, and
1152
returns a string representation of the first authorized heading. This routine
1153
should be considered a temporary shim to ease the future migration of authority
1154
data from C4::AuthoritiesMarc to the object-oriented Koha::*::Authority.
1155
1156
=cut
1157
1158
sub GetAuthorizedHeading {
1159
    my $args = shift;
1160
    my $record;
1161
    unless ($record = $args->{record}) {
1162
        return unless $args->{authid};
1163
        $record = GetAuthority($args->{authid});
1164
    }
1165
    if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
1166
# construct UNIMARC summary, that is quite different from MARC21 one
1167
# accepted form
1168
        foreach my $field ($record->field('2..')) {
1169
            return $field->as_string('abcdefghijlmnopqrstuvwxyz');
1170
        }
1171
    } else {
1172
        foreach my $field ($record->field('1..')) {
1173
            my $tag = $field->tag();
1174
            next if "152" eq $tag;
1175
# FIXME - 152 is not a good tag to use
1176
# in MARC21 -- purely local tags really ought to be
1177
# 9XX
1178
            if ($tag eq '100') {
1179
                return $field->as_string('abcdefghjklmnopqrstvxyz68');
1180
            } elsif ($tag eq '110') {
1181
                return $field->as_string('abcdefghklmnoprstvxyz68');
1182
            } elsif ($tag eq '111') {
1183
                return $field->as_string('acdefghklnpqstvxyz68');
1184
            } elsif ($tag eq '130') {
1185
                return $field->as_string('adfghklmnoprstvxyz68');
1186
            } elsif ($tag eq '148') {
1187
                return $field->as_string('abvxyz68');
1188
            } elsif ($tag eq '150') {
1189
                return $field->as_string('abvxyz68');
1190
            } elsif ($tag eq '151') {
1191
                return $field->as_string('avxyz68');
1192
            } elsif ($tag eq '155') {
1193
                return $field->as_string('abvxyz68');
1194
            } elsif ($tag eq '180') {
1195
                return $field->as_string('vxyz68');
1196
            } elsif ($tag eq '181') {
1197
                return $field->as_string('vxyz68');
1198
            } elsif ($tag eq '182') {
1199
                return $field->as_string('vxyz68');
1200
            } elsif ($tag eq '185') {
1201
                return $field->as_string('vxyz68');
1202
            } else {
1203
                return $field->as_string();
1204
            }
1205
        }
1206
    }
1207
    return;
1208
}
1209
1147
=head2 BuildUnimarcHierarchies
1210
=head2 BuildUnimarcHierarchies
1148
1211
1149
  $text= &BuildUnimarcHierarchies( $authid, $force)
1212
  $text= &BuildUnimarcHierarchies( $authid, $force)
1150
- 

Return to bug 9149