Bugzilla – Attachment 192118 Details for
Bug 41685
MARC21: Sort 4xx/5xx in BuildSummary alphabetic within hierarchy ($w: g or h)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 46185: Sort see from / see also in BuildSummary
Bug-46185-Sort-see-from--see-also-in-BuildSummary.patch (text/plain), 2.12 KB, created by
Marcel de Rooy
on 2026-01-28 13:01:05 UTC
(
hide
)
Description:
Bug 46185: Sort see from / see also in BuildSummary
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2026-01-28 13:01:05 UTC
Size:
2.12 KB
patch
obsolete
>From 042d014c71009d2a0697edb948d32796e7b6485f Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 28 Jan 2026 13:56:13 +0100 >Subject: [PATCH] Bug 46185: Sort see from / see also in BuildSummary >Content-Type: text/plain; charset=utf-8 > >Test plan: >Comes very soon. >--- > C4/AuthoritiesMarc.pm | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) > >diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm >index c2070f4560..56284136f9 100644 >--- a/C4/AuthoritiesMarc.pm >+++ b/C4/AuthoritiesMarc.pm >@@ -1076,7 +1076,8 @@ sub BuildSummary { > }; > } > } >- foreach my $field ( $record->field('4..') ) { #See From >+ my @fields = _marc21_sort_hierarchy_alpha( $record->field('4..') ); >+ foreach my $field (@fields) { #See From > my $type = 'seefrom'; > $type = ( $marc21controlrefs{ substr $field->subfield('w'), 0, 1 } || '' ) if ( $field->subfield('w') ); > if ( $type eq 'notapplicable' ) { >@@ -1099,7 +1100,8 @@ sub BuildSummary { > }; > } > } >- foreach my $field ( $record->field('5..') ) { #See Also >+ @fields = _marc21_sort_hierarchy_alpha( $record->field('5..') ); >+ foreach my $field (@fields) { #See Also > my $type = 'seealso'; > $type = ( $marc21controlrefs{ substr $field->subfield('w'), 0, 1 } || '' ) if ( $field->subfield('w') ); > if ( $type eq 'notapplicable' ) { >@@ -1231,6 +1233,18 @@ sub BuildSummary { > return \%summary; > } > >+sub _marc21_sort_hierarchy_alpha { >+ my @fields = @_; >+ return sort { >+ # Sort broader (g) - no hierarchy (tric:gh) - narrower (h) >+ my $a_hier = $a->subfield('w') // q{}; $a_hier = 'gh' if $a_hier !~ /^[gh]$/; >+ my $b_hier = $b->subfield('w') // q{}; $b_hier = 'gh' if $b_hier !~ /^[gh]$/; >+ >+ # When hierarchy does not resolve, sort on $a >+ $a_hier cmp $b_hier || $a->subfield('a') cmp $b->subfield('a'); >+ } @fields; >+} >+ > =head2 GetAuthorizedHeading > > $heading = &GetAuthorizedHeading({ record => $record, authid => $authid }) >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41685
:
192118
|
192318
|
192319