From a8b075a4d3629af28db60d538cef103e9f02c9ba Mon Sep 17 00:00:00 2001 From: George Veranis Date: Fri, 2 Jul 2021 16:41:24 +0200 Subject: [PATCH] Bug 27943: Add support for 7XX equal terms on authorities marc21 display Currently when a MARC21 authority has 7XX field they do not display on authority search result page. 7XX is equal term of 1XX based on LC rules. Applying this patch will enable that feature, which is important for non latin catalogues. Test plan: 1) Add a new authority with 1XX and 7XX fields. 2) Try to search that authority and check if 7XX values are displayed 3) Apply this patch 4) Try to search that authority and you will see that 7XX values are displayed like "1XX = 7XX" Sponsored-by: Keratsini-Drapetsona Municipal Library, Greece Mentored-by: Andreas Roussos Signed-off-by: Frank Hansen Works for me! Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- C4/AuthoritiesMarc.pm | 79 +++++++++++++++++++ .../includes/authorities-search-results.inc | 6 ++ .../includes/authorities-search-results.inc | 6 ++ 3 files changed, 91 insertions(+) diff --git a/C4/AuthoritiesMarc.pm b/C4/AuthoritiesMarc.pm index d21e7c059c..8331eba558 100644 --- a/C4/AuthoritiesMarc.pm +++ b/C4/AuthoritiesMarc.pm @@ -936,6 +936,8 @@ sub BuildSummary { my @seefrom; my @seealso; my @otherscript; + my @equalterm; + if (C4::Context->preference('marcflavour') eq 'UNIMARC') { # construct UNIMARC summary, that is quite different from MARC21 one # accepted form @@ -989,6 +991,8 @@ sub BuildSummary { use C4::Heading::MARC21; my $handler = C4::Heading::MARC21->new(); my $subfields_to_report; + my $subfields_to_subdivision=""; + my $delimiter = " -- "; foreach my $field ($record->field('1..')) { my $tag = $field->tag(); next if "152" eq $tag; @@ -1065,6 +1069,80 @@ sub BuildSummary { foreach my $field ($record->field('6..')) { push @notes, { note => $field->as_string(), field => $field->tag() }; } + + foreach my $field ($record->field('7..')) + { + my $tag = $field->tag(); + + 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=" "; + } elsif ($tag eq '781') { + $subfields_to_report = 'vxyz'; + $delimiter=" "; + } elsif ($tag eq '782') { + $subfields_to_report = 'vxyz'; + $delimiter=" "; + } elsif ($tag eq '785') { + $subfields_to_report = 'vxyz'; + $delimiter=" "; + } + + my $heading = $field->as_string($subfields_to_report); + + my $subheading = $field->as_string($subfields_to_subdivision,$delimiter); + if(length $subheading > 0 ) + { + $heading.=$delimiter.$subheading; + } + + if ($subfields_to_report) { + push @equalterm, { + heading => $heading, + hemain => ( $field->subfield( substr($subfields_to_report, 0, 1) ) // undef ), + field => $tag, + }; + } else { + push @equalterm, { + heading => $field->as_string(), + hemain => ( $field->subfield( 'a' ) // undef ), + field => $tag, + }; + } + } + foreach my $field ($record->field('880')) { my $linkage = $field->subfield('6'); my $category = substr $linkage, 0, 1; @@ -1092,6 +1170,7 @@ sub BuildSummary { $summary{seefrom} = \@seefrom; $summary{seealso} = \@seealso; $summary{otherscript} = \@otherscript; + $summary{equalterm} = \@equalterm; return \%summary; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search-results.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search-results.inc index 819face44c..8924320f87 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search-results.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search-results.inc @@ -69,6 +69,12 @@ [% UNLESS loop.last %] | [% END %] [% END %] + [% IF summary.equalterm.size %] + [% FOREACH term IN summary.equalterm %] + = + [% term.heading %] + [% END %] + [% END %] [% IF ( marcflavour == 'UNIMARC' ) %] [% IF summary.notes %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/authorities-search-results.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/authorities-search-results.inc index faf507fe44..7fbfe52ef3 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/authorities-search-results.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/authorities-search-results.inc @@ -61,6 +61,12 @@ [% authorize.heading | html %] [% UNLESS loop.last %] | [% END %] [% END %] + [% IF summary.equalterm.size %] + [% FOREACH term IN summary.equalterm %] + = + [% term.heading %] + [% END %] + [% END %] [% IF ( marcflavour == 'UNIMARC' ) %] [% IF summary.notes %] -- 2.39.5