From 07f77d90313bbc1095f16339bf1b271e95c50a14 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Thu, 17 Dec 2020 15:47:48 +0100 Subject: [PATCH] Bug 18017: Add subdivisions to UNIMARC authorities zebra configuration Like for MARC21, UNIMARC authorities has subdivisions form, general, chronological and geographic. In C4::Heading::UNIMARC, use subdivisions in _get_search_heading like in C4::Heading::MARC21. Adds subdivisions variables into UNIMARC authorities zebra configuration. Note that unlike MARC21 geographic is subfield $y and chronological is subfield $z. See https://www.ifla.org/publications/unimarc-formats-and-related-documentation Signed-off-by: Martin Renvoize Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Jonathan Druart (cherry picked from commit cb0f2793908b1b2f7da01c2b32a706508902a1b6) Signed-off-by: Fridolin Somers --- C4/Heading/UNIMARC.pm | 13 +++++++++---- .../authorities/authority-koha-indexdefs.xml | 6 ++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/C4/Heading/UNIMARC.pm b/C4/Heading/UNIMARC.pm index f1b5287708..b998433a43 100644 --- a/C4/Heading/UNIMARC.pm +++ b/C4/Heading/UNIMARC.pm @@ -52,8 +52,8 @@ FIXME - this should be moved to a configuration file. my %subdivisions = ( 'j' => 'formsubdiv', 'x' => 'generalsubdiv', - 'y' => 'chronologicalsubdiv', - 'z' => 'geographicsubdiv', + 'y' => 'geographicsubdiv', + 'z' => 'chronologicalsubdiv', ); my $bib_heading_fields; @@ -160,14 +160,19 @@ sub _get_search_heading { my $code = $subfields[$i]->[0]; my $code_re = quotemeta $code; my $value = $subfields[$i]->[1]; - $value =~ s/[-,.:=;!%\/]*$//; + $value =~ s/[\s]*[-,.:=;!%\/][\s]*$//; next unless $subfields =~ qr/$code_re/; if ($first) { $first = 0; $heading = $value; } else { - $heading .= " $value"; + if ( exists $subdivisions{$code} ) { + $heading .= " $subdivisions{$code} $value"; + } + else { + $heading .= " $value"; + } } } diff --git a/etc/zebradb/marc_defs/unimarc/authorities/authority-koha-indexdefs.xml b/etc/zebradb/marc_defs/unimarc/authorities/authority-koha-indexdefs.xml index 00b4e0be07..91399e3ad7 100644 --- a/etc/zebradb/marc_defs/unimarc/authorities/authority-koha-indexdefs.xml +++ b/etc/zebradb/marc_defs/unimarc/authorities/authority-koha-indexdefs.xml @@ -7,6 +7,12 @@ authority-zebra-indexdefs.xsl` --> marc:controlfield[@tag='001'] + + j + x + y + z + Local-Number:w -- 2.39.5