Bugzilla – Attachment 167245 Details for
Bug 35989
Searching Geographic authorities generates error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35989: (QA follow-up) Add test and limit variable scope
Bug-35989-QA-follow-up-Add-test-and-limit-variable.patch (text/plain), 3.33 KB, created by
Nick Clemens (kidclamp)
on 2024-05-29 14:03:07 UTC
(
hide
)
Description:
Bug 35989: (QA follow-up) Add test and limit variable scope
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-05-29 14:03:07 UTC
Size:
3.33 KB
patch
obsolete
>From 86fe2ccca6ca4aca431d586174c2f3f6e81139c4 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 29 May 2024 13:54:52 +0000 >Subject: [PATCH] Bug 35989: (QA follow-up) Add test and limit variable scope > >Before this patch if a record had a 751 and a 781 you could have fields repeated. >This patch reduces the scope of the fields to subdivision variable as it is only used in processing 7xx >fields and should not be shared between fields. > >I also add unit tests > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > C4/AuthoritiesMarc.pm | 6 +++--- > t/db_dependent/AuthoritiesMarc.t | 27 ++++++++++++++++++++------- > 2 files changed, 23 insertions(+), 10 deletions(-) > >diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm >index ecc8c53d420..4c61f8bedb2 100644 >--- a/C4/AuthoritiesMarc.pm >+++ b/C4/AuthoritiesMarc.pm >@@ -1015,8 +1015,7 @@ sub BuildSummary { > use C4::Heading::MARC21; > my $handler = C4::Heading::MARC21->new(); > my $subfields_to_report; >- my $subfields_to_subdivision = ""; >- my $delimiter = C4::Context->preference('AuthoritySeparator'); >+ my $delimiter = C4::Context->preference('AuthoritySeparator'); > > foreach my $field ($record->field('1..')) { > my $tag = $field->tag(); >@@ -1095,7 +1094,8 @@ sub BuildSummary { > push @notes, { note => $field->as_string(), field => $field->tag() }; > } > >- foreach my $field ( $record->field('7..') ) { >+ foreach my $field ( $record->field('7..') ) { >+ my $subfields_to_subdivision; > my $tag = $field->tag(); > > if ( $tag eq '700' ) { >diff --git a/t/db_dependent/AuthoritiesMarc.t b/t/db_dependent/AuthoritiesMarc.t >index 3823dd9d5c7..e1b117fbc6b 100755 >--- a/t/db_dependent/AuthoritiesMarc.t >+++ b/t/db_dependent/AuthoritiesMarc.t >@@ -41,8 +41,10 @@ $module->mock('GetAuthority', sub { > $record->add_fields( > [ '001', '2' ], > [ '151', ' ', ' ', a => 'New York (State)' ], >- [ '551', ' ', ' ', a => 'United States', w => 'g', 9 => '1' ] >- ); >+ [ '551', ' ', ' ', a => 'United States', w => 'g', 9 => '1' ], >+ [ '751', ' ', ' ', a => 'United States', w => 'g', 9 => '1' ], >+ [ '781', ' ', ' ', a => 'New York', x => 'General subdivision', 9 => '1' ] >+ ); > } elsif ($authid eq '3') { > $record->add_fields( > [ '001', '3' ], >@@ -151,14 +153,25 @@ my $expected_marc21_summary = { > 'type' => 'broader' > } > ], >- 'seefrom' => [], >- 'label' => 'Geographic Name', >- 'type' => 'Geographic Name', >- 'equalterm' => [] >+ 'equalterm' => [ >+ { >+ 'field' => '751', >+ 'hemain' => 'United States', >+ 'heading' => 'United States' >+ }, >+ { >+ 'hemain' => undef, >+ 'field' => '781', >+ 'heading' => 'General subdivision' >+ } >+ ], >+ 'seefrom' => [], >+ 'label' => 'Geographic Name', >+ 'type' => 'Geographic Name', > }; > > is_deeply( >- BuildSummary(C4::AuthoritiesMarc::GetAuthority(2), 2, 'GEOGR_NAME'), >+ BuildSummary( C4::AuthoritiesMarc::GetAuthority(2), 2, 'GEOGR_NAME' ), > $expected_marc21_summary, > 'test BuildSummary for MARC21' > ); >-- >2.39.2
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 35989
:
166811
|
166821
|
167244
|
167245
|
167267
|
167422
|
167423
|
167424