From 6a08e1142837a1a8f866c242c13f5c5d1ea64c20 Mon Sep 17 00:00:00 2001 From: George Veranis Date: Mon, 20 Feb 2023 12:02:27 +0100 Subject: [PATCH] Bug 27943: (follow-up) Fix unit test, and use systempreference AuthoritySeparator Instead of hardcoding the separator we take the value from systempreference. Also adjust the unit test to expect the "equalterm" array. Test plan same as before. --- C4/AuthoritiesMarc.pm | 13 +++---------- t/db_dependent/AuthoritiesMarc.t | 7 +++++-- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index b41e937c33..adab9f9075 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -987,7 +987,8 @@ sub BuildSummary { my $handler = C4::Heading::MARC21->new(); my $subfields_to_report; my $subfields_to_subdivision=""; - my $delimiter = " -- "; + my $delimiter = C4::Context->preference('AuthoritySeparator'); + foreach my $field ($record->field('1..')) { my $tag = $field->tag(); next if "152" eq $tag; @@ -1072,35 +1073,27 @@ sub BuildSummary { if ($tag eq '700') { $subfields_to_report = 'abcdefghjklmnopqrst'; $subfields_to_subdivision='vxyz'; - $delimiter=" -- "; } elsif ($tag eq '710') { $subfields_to_report = 'abcdefghklmnoprst'; $subfields_to_subdivision='vxyz'; - $delimiter=" -- "; } elsif ($tag eq '711') { $subfields_to_report = 'acdefghklnpqst'; $subfields_to_subdivision='vxyz'; - $delimiter=" -- "; } elsif ($tag eq '730') { $subfields_to_report = 'adfghklmnoprst'; $subfields_to_subdivision='vxyz'; - $delimiter=" -- "; } elsif ($tag eq '748') { $subfields_to_report = 'ab'; $subfields_to_subdivision='vxyz'; - $delimiter=" -- "; } elsif ($tag eq '750') { $subfields_to_report = 'ab'; $subfields_to_subdivision='vxyz'; - $delimiter=" -- "; } elsif ($tag eq '751') { $subfields_to_report = 'a'; $subfields_to_subdivision='vxyz'; - $delimiter=" -- "; } elsif ($tag eq '755') { $subfields_to_report = 'abvxyz'; $subfields_to_subdivision='vxyz'; - $delimiter=" -- "; } elsif ($tag eq '780') { $subfields_to_report = 'vxyz'; $delimiter=" "; @@ -1111,7 +1104,7 @@ sub BuildSummary { $subfields_to_report = 'vxyz'; $delimiter=" "; } elsif ($tag eq '785') { - $subfields_to_report = 'vxyz'; + $subfields_to_report = 'vxyz'; $delimiter=" "; } diff --git a/t/db_dependent/AuthoritiesMarc.t b/t/db_dependent/AuthoritiesMarc.t index f72b0c3705..2bb69ba36c 100755 --- a/t/db_dependent/AuthoritiesMarc.t +++ b/t/db_dependent/AuthoritiesMarc.t @@ -153,7 +153,8 @@ my $expected_marc21_summary = { ], 'seefrom' => [], 'label' => 'Geographic Name', - 'type' => 'Geographic Name' + 'type' => 'Geographic Name', + 'equalterm' => [] }; is_deeply( BuildSummary(C4::AuthoritiesMarc::GetAuthority(2), 2, 'GEOGR_NAME'), @@ -196,7 +197,9 @@ my $expected_unimarc_name_summary = { 'seealso' => [], 'seefrom' => [], 'summary' => 'Fossey, Brigitte', - 'type' => 'Auteur' + 'type' => 'Auteur', + 'equalterm' => [] + }; is_deeply( -- 2.20.1