Bugzilla – Attachment 192587 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 41685: (QA follow-up) Resolve qa warnings
Bug-41685-QA-follow-up-Resolve-qa-warnings.patch (text/plain), 3.11 KB, created by
Marcel de Rooy
on 2026-02-06 08:38:56 UTC
(
hide
)
Description:
Bug 41685: (QA follow-up) Resolve qa warnings
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2026-02-06 08:38:56 UTC
Size:
3.11 KB
patch
obsolete
>From 2c0b8352c35ea4c7220d4e98c2864d053682aa06 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 6 Feb 2026 09:34:44 +0100 >Subject: [PATCH] Bug 41685: (QA follow-up) Resolve qa warnings >Content-Type: text/plain; charset=utf-8 > >Resolve critic warn: >"return" statement followed by "sort" at line 1238, column 5. Behavior is undefined if called in scalar context. (Severity: 5) > >Tidied with lastest perltidy version. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/AuthoritiesMarc.pm | 24 ++++++++++++++---------- > t/db_dependent/AuthoritiesMarc.t | 1 + > 2 files changed, 15 insertions(+), 10 deletions(-) > >diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm >index ebb33b978f..b0cc40ee14 100644 >--- a/C4/AuthoritiesMarc.pm >+++ b/C4/AuthoritiesMarc.pm >@@ -1077,7 +1077,7 @@ sub BuildSummary { > } > } > my @fields = _marc21_sort_hierarchy_alpha( $record->field('4..') ); >- foreach my $field (@fields) { #See From >+ 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' ) { >@@ -1101,7 +1101,7 @@ sub BuildSummary { > } > } > @fields = _marc21_sort_hierarchy_alpha( $record->field('5..') ); >- foreach my $field (@fields) { #See Also >+ 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' ) { >@@ -1235,14 +1235,18 @@ sub BuildSummary { > > 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; >+ 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 >diff --git a/t/db_dependent/AuthoritiesMarc.t b/t/db_dependent/AuthoritiesMarc.t >index 681f428e0b..62099fe6ef 100755 >--- a/t/db_dependent/AuthoritiesMarc.t >+++ b/t/db_dependent/AuthoritiesMarc.t >@@ -401,6 +401,7 @@ subtest 'DelAuthority() tests' => sub { > > subtest 'BuildSummary/_marc21_sort_hierarchy_alpha' => sub { > plan tests => 1; >+ > #$schema->storage->txn_begin; > #t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); > >-- >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
|
192539
|
192540
| 192587 |
193004