From 9c7dac8f13ba2144ed911759ef1ae97cb0a13068 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 13 Feb 2020 11:33:15 +0000 Subject: [PATCH] Bug 21800: Make TransformKohaToMarc aware of non-repeatable subfields Content-Type: text/plain; charset=utf-8 If a kohafield (in Koha to MARC mappings) contains a pipe char (say A | B), we split it up into two subfields A and B in MARC. We will only do that for repeatable subfields now. If the field is not repeatable, the value will just be 'A | B'. Note: Does this impact the reverse operation in TransformMarcToKoha? No, the check on repeatable subfields is done in the interface and not in TransformMarcToKoha. This routine simply translates two instances of the same subfield, say A and B, into the value 'A | B' for a kohafield. Not allowing two instances of a non-repeatable subfield is not in the scope of this report. Signed-off-by: Marcel de Rooy --- C4/Biblio.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index aa401d5646..6675475602 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1991,7 +1991,10 @@ sub TransformKohaToMarc { my $tagfield = $fld->{tagfield}; my $tagsubfield = $fld->{tagsubfield}; next if !$tagfield; - my @values = $params->{no_split} + + # BZ 21800: split value if field is repeatable; NOTE that this also + # depends on the Default framework. + my @values = $params->{no_split} || !$fld->{repeatable} ? ( $value ) : split(/\s?\|\s?/, $value, -1); foreach my $value ( @values ) { -- 2.11.0