Lines 1990-1996
sub TransformKohaToMarc {
Link Here
|
1990 |
|
1990 |
|
1991 |
# In the next call we use the Default framework, since it is considered |
1991 |
# In the next call we use the Default framework, since it is considered |
1992 |
# authoritative for Koha to Marc mappings. |
1992 |
# authoritative for Koha to Marc mappings. |
1993 |
my $mss = GetMarcSubfieldStructure( '', { unsafe => 1 } ); # do not change framewok |
1993 |
my $mss = GetMarcSubfieldStructure( '', { unsafe => 1 } ); # do not change framework |
|
|
1994 |
my $mss2; # belongs to $params->{framework} only filled when needed |
1994 |
my $tag_hr = {}; |
1995 |
my $tag_hr = {}; |
1995 |
while ( my ($kohafield, $value) = each %$hash ) { |
1996 |
while ( my ($kohafield, $value) = each %$hash ) { |
1996 |
foreach my $fld ( @{ $mss->{$kohafield} } ) { |
1997 |
foreach my $fld ( @{ $mss->{$kohafield} } ) { |
Lines 1999-2005
sub TransformKohaToMarc {
Link Here
|
1999 |
next if !$tagfield; |
2000 |
next if !$tagfield; |
2000 |
|
2001 |
|
2001 |
# BZ 21800: split value if field is repeatable. |
2002 |
# BZ 21800: split value if field is repeatable. |
2002 |
my @values = _check_split($params, $fld, $value) |
2003 |
my @values = _check_split($params, $mss2, $fld, $value) |
2003 |
? split(/\s?\|\s?/, $value, -1) |
2004 |
? split(/\s?\|\s?/, $value, -1) |
2004 |
: ( $value ); |
2005 |
: ( $value ); |
2005 |
foreach my $value ( @values ) { |
2006 |
foreach my $value ( @values ) { |
Lines 2023-2029
sub TransformKohaToMarc {
Link Here
|
2023 |
} |
2024 |
} |
2024 |
|
2025 |
|
2025 |
sub _check_split { |
2026 |
sub _check_split { |
2026 |
my ($params, $fld, $value) = @_; |
2027 |
my ($params, $mss2, $fld, $value) = @_; |
2027 |
return if index($value,'|') == -1; # nothing to worry about |
2028 |
return if index($value,'|') == -1; # nothing to worry about |
2028 |
return if $params->{no_split}; |
2029 |
return if $params->{no_split}; |
2029 |
|
2030 |
|
Lines 2031-2038
sub _check_split {
Link Here
|
2031 |
return $fld->{repeatable} if !$params->{framework}; |
2032 |
return $fld->{repeatable} if !$params->{framework}; |
2032 |
|
2033 |
|
2033 |
# here we need to check the specific framework |
2034 |
# here we need to check the specific framework |
2034 |
my $mss = Koha::MarcSubfieldStructures->find( $params->{framework}, $fld->{tagfield}, $fld->{tagsubfield} ); |
2035 |
$mss2 = GetMarcSubfieldStructure($params->{framework}, { unsafe => 1 }) |
2035 |
return 1 if $mss && $mss->repeatable; |
2036 |
if !$mss2; |
|
|
2037 |
foreach my $fld2 ( @{ $mss2->{ $fld->{kohafield} } } ) { |
2038 |
next if $fld2->{tagfield} ne $fld->{tagfield}; |
2039 |
next if $fld2->{tagsubfield} ne $fld->{tagsubfield}; |
2040 |
return 1 if $fld2->{repeatable}; |
2041 |
} |
2042 |
return; |
2036 |
} |
2043 |
} |
2037 |
|
2044 |
|
2038 |
=head2 PrepHostMarcField |
2045 |
=head2 PrepHostMarcField |