@@ -, +, @@ --- C4/Biblio.pm | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) --- a/C4/Biblio.pm +++ a/C4/Biblio.pm @@ -1991,9 +1991,7 @@ sub TransformKohaToMarc { # In the next call we use the Default framework, since it is considered # authoritative for Koha to Marc mappings. my $mss = GetMarcSubfieldStructure( '', { unsafe => 1 } ); # do not change framework - my $mss2; # belongs to $params->{framework} only filled when needed my $tag_hr = {}; - my $need_split; while ( my ($kohafield, $value) = each %$hash ) { foreach my $fld ( @{ $mss->{$kohafield} } ) { my $tagfield = $fld->{tagfield}; @@ -2001,7 +1999,7 @@ sub TransformKohaToMarc { next if !$tagfield; # BZ 21800: split value if field is repeatable. - ( $need_split, $mss2 ) = _check_split($params, $mss2, $fld, $value); + my $need_split = _check_split($params, $fld, $value); my @values = $need_split ? split(/\s?\|\s?/, $value, -1) : ( $value ); @@ -2028,23 +2026,21 @@ sub TransformKohaToMarc { sub _check_split { # Checks if $value must be split; may consult passed framework # Returns 0|1, and framework hash if consulted - my ($params, $mss2, $fld, $value) = @_; - return (0, $mss2) if index($value,'|') == -1; # nothing to worry about - return (0, $mss2) if $params->{no_split}; + my ($params, $fld, $value) = @_; + return if index($value,'|') == -1; # nothing to worry about + return if $params->{no_split}; # if we did not get a specific framework, check default in $mss - return ( $fld->{repeatable}, $mss2) if !$params->{framework}; + return $fld->{repeatable} if !$params->{framework}; # here we need to check the specific framework - if(!$mss2) { - $mss2 = GetMarcSubfieldStructure($params->{framework}, { unsafe => 1 }); - } - foreach my $fld2 ( @{ $mss2->{ $fld->{kohafield} } } ) { + my $mss = GetMarcSubfieldStructure($params->{framework}, { unsafe => 1 }); + foreach my $fld2 ( @{ $mss->{ $fld->{kohafield} } } ) { next if $fld2->{tagfield} ne $fld->{tagfield}; next if $fld2->{tagsubfield} ne $fld->{tagsubfield}; - return (1, $mss2) if $fld2->{repeatable}; + return 1 if $fld2->{repeatable}; } - return (0, $mss2); + return; } =head2 PrepHostMarcField --