From a16f3e673713b98a6afc564b8bdcfd4233069c74 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. Signed-off-by: Christian Nelson Signed-off-by: Katrin Fischer --- 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 8331eba558..67464d826d 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -992,7 +992,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; @@ -1077,35 +1078,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=" "; @@ -1116,7 +1109,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.30.2