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

(-)a/C4/AuthoritiesMarc.pm (-3 / +16 lines)
Lines 1076-1082 sub BuildSummary { Link Here
1076
                };
1076
                };
1077
            }
1077
            }
1078
        }
1078
        }
1079
        foreach my $field ( $record->field('4..') ) {    #See From
1079
        my @fields = _marc21_sort_hierarchy_alpha( $record->field('4..') );
1080
        foreach my $field (@fields) {    #See From
1080
            my $type = 'seefrom';
1081
            my $type = 'seefrom';
1081
            $type = ( $marc21controlrefs{ substr $field->subfield('w'), 0, 1 } || '' ) if ( $field->subfield('w') );
1082
            $type = ( $marc21controlrefs{ substr $field->subfield('w'), 0, 1 } || '' ) if ( $field->subfield('w') );
1082
            if ( $type eq 'notapplicable' ) {
1083
            if ( $type eq 'notapplicable' ) {
Lines 1099-1105 sub BuildSummary { Link Here
1099
                };
1100
                };
1100
            }
1101
            }
1101
        }
1102
        }
1102
        foreach my $field ( $record->field('5..') ) {    #See Also
1103
        @fields = _marc21_sort_hierarchy_alpha( $record->field('5..') );
1104
        foreach my $field (@fields) {    #See Also
1103
            my $type = 'seealso';
1105
            my $type = 'seealso';
1104
            $type = ( $marc21controlrefs{ substr $field->subfield('w'), 0, 1 } || '' ) if ( $field->subfield('w') );
1106
            $type = ( $marc21controlrefs{ substr $field->subfield('w'), 0, 1 } || '' ) if ( $field->subfield('w') );
1105
            if ( $type eq 'notapplicable' ) {
1107
            if ( $type eq 'notapplicable' ) {
Lines 1231-1236 sub BuildSummary { Link Here
1231
    return \%summary;
1233
    return \%summary;
1232
}
1234
}
1233
1235
1236
sub _marc21_sort_hierarchy_alpha {
1237
    my @fields = @_;
1238
    return sort {
1239
        # Sort broader (g) - no hierarchy (tric:gh) - narrower (h)
1240
        my $a_hier = $a->subfield('w') // q{}; $a_hier = 'gh' if $a_hier !~ /^[gh]$/;
1241
        my $b_hier = $b->subfield('w') // q{}; $b_hier = 'gh' if $b_hier !~ /^[gh]$/;
1242
1243
        # When hierarchy does not resolve, sort on $a
1244
        $a_hier cmp $b_hier || $a->subfield('a') cmp $b->subfield('a');
1245
        } @fields;
1246
}
1247
1234
=head2 GetAuthorizedHeading
1248
=head2 GetAuthorizedHeading
1235
1249
1236
  $heading = &GetAuthorizedHeading({ record => $record, authid => $authid })
1250
  $heading = &GetAuthorizedHeading({ record => $record, authid => $authid })
1237
- 

Return to bug 41685