| Lines 1991-1999
          sub TransformKohaToMarc {
      
      
        Link Here | 
        
          | 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 framework | 1993 |     my $mss = GetMarcSubfieldStructure( '', { unsafe => 1 } ); # do not change framework | 
            
              | 1994 |     my $mss2; # belongs to $params->{framework} only filled when needed |  |  | 
        
          | 1995 |     my $tag_hr = {}; | 1994 |     my $tag_hr = {}; | 
            
              | 1996 |     my $need_split; |  |  | 
        
          | 1997 |     while ( my ($kohafield, $value) = each %$hash ) { | 1995 |     while ( my ($kohafield, $value) = each %$hash ) { | 
        
          | 1998 |         foreach my $fld ( @{ $mss->{$kohafield} } ) { | 1996 |         foreach my $fld ( @{ $mss->{$kohafield} } ) { | 
        
          | 1999 |             my $tagfield    = $fld->{tagfield}; | 1997 |             my $tagfield    = $fld->{tagfield}; | 
  
    | Lines 2001-2007
          sub TransformKohaToMarc {
      
      
        Link Here | 
        
          | 2001 |             next if !$tagfield; | 1999 |             next if !$tagfield; | 
        
          | 2002 |  | 2000 |  | 
        
          | 2003 |             # BZ 21800: split value if field is repeatable. | 2001 |             # BZ 21800: split value if field is repeatable. | 
          
            
              | 2004 |             ( $need_split, $mss2 ) = _check_split($params, $mss2, $fld, $value); | 2002 |             my $need_split = _check_split($params, $fld, $value); | 
        
          | 2005 |             my @values = $need_split | 2003 |             my @values = $need_split | 
        
          | 2006 |                 ? split(/\s?\|\s?/, $value, -1) | 2004 |                 ? split(/\s?\|\s?/, $value, -1) | 
        
          | 2007 |                 : ( $value ); | 2005 |                 : ( $value ); | 
  
    | Lines 2028-2050
          sub TransformKohaToMarc {
      
      
        Link Here | 
        
          | 2028 | sub _check_split { | 2026 | sub _check_split { | 
        
          | 2029 | # Checks if $value must be split; may consult passed framework | 2027 | # Checks if $value must be split; may consult passed framework | 
        
          | 2030 | # Returns 0|1, and framework hash if consulted | 2028 | # Returns 0|1, and framework hash if consulted | 
          
            
              | 2031 |     my ($params, $mss2, $fld, $value) = @_; | 2029 |     my ($params, $fld, $value) = @_; | 
            
              | 2032 |     return (0, $mss2) if index($value,'|') == -1; # nothing to worry about | 2030 |     return if index($value,'|') == -1; # nothing to worry about | 
            
              | 2033 |     return (0, $mss2) if $params->{no_split}; | 2031 |     return if $params->{no_split}; | 
        
          | 2034 |  | 2032 |  | 
        
          | 2035 |     # if we did not get a specific framework, check default in $mss | 2033 |     # if we did not get a specific framework, check default in $mss | 
          
            
              | 2036 |     return ( $fld->{repeatable}, $mss2) if !$params->{framework}; | 2034 |     return $fld->{repeatable} if !$params->{framework}; | 
        
          | 2037 |  | 2035 |  | 
        
          | 2038 |     # here we need to check the specific framework | 2036 |     # here we need to check the specific framework | 
          
            
              | 2039 |     if(!$mss2) { | 2037 |     my $mss = GetMarcSubfieldStructure($params->{framework}, { unsafe => 1 }); | 
            
              | 2040 |         $mss2 = GetMarcSubfieldStructure($params->{framework}, { unsafe => 1 }); | 2038 |     foreach my $fld2 ( @{ $mss->{ $fld->{kohafield} } } ) { | 
            
              | 2041 |     } |  |  | 
            
              | 2042 |     foreach my $fld2 ( @{ $mss2->{ $fld->{kohafield} } } ) { | 
        
          | 2043 |         next if $fld2->{tagfield} ne $fld->{tagfield}; | 2039 |         next if $fld2->{tagfield} ne $fld->{tagfield}; | 
        
          | 2044 |         next if $fld2->{tagsubfield} ne $fld->{tagsubfield}; | 2040 |         next if $fld2->{tagsubfield} ne $fld->{tagsubfield}; | 
          
            
              | 2045 |         return (1, $mss2) if $fld2->{repeatable}; | 2041 |         return 1 if $fld2->{repeatable}; | 
        
          | 2046 |     } | 2042 |     } | 
          
            
              | 2047 |     return (0, $mss2); | 2043 |     return; | 
        
          | 2048 | } | 2044 | } | 
        
          | 2049 |  | 2045 |  | 
        
          | 2050 | =head2 PrepHostMarcField | 2046 | =head2 PrepHostMarcField | 
            
              | 2051 | -  |  |  |