View | Details | Raw Unified | Return to bug 16809
Collapse All | Expand All

(-)a/C4/Biblio.pm (-7 / +8 lines)
Lines 2561-2578 sub TransformHtmlToMarc { Link Here
2561
            if ( $tag < 10 ) {                              # no code for theses fields
2561
            if ( $tag < 10 ) {                              # no code for theses fields
2562
                                                            # in MARC editor, 000 contains the leader.
2562
                                                            # in MARC editor, 000 contains the leader.
2563
                next if $tag == $biblionumbertagfield;
2563
                next if $tag == $biblionumbertagfield;
2564
                my $fval= $cgi->param($params[$j+1]);
2564
                if ( $tag eq '000' ) {
2565
                if ( $tag eq '000' ) {
2565
                    # Force a fake leader even if not provided to avoid crashing
2566
                    # Force a fake leader even if not provided to avoid crashing
2566
                    # during decoding MARC record containing UTF-8 characters
2567
                    # during decoding MARC record containing UTF-8 characters
2567
                    $record->leader(
2568
                    $record->leader(
2568
                        length( $cgi->param($params[$j+1]) ) == 24
2569
                        length( $fval ) == 24
2569
                        ? $cgi->param( $params[ $j + 1 ] )
2570
                        ? $fval
2570
                        : '     nam a22        4500'
2571
                        : '     nam a22        4500'
2571
			)
2572
			)
2572
                    ;
2573
                    ;
2573
                    # between 001 and 009 (included)
2574
                    # between 001 and 009 (included)
2574
                } elsif ( $cgi->param( $params[ $j + 1 ] ) ne '' ) {
2575
                } elsif ( $fval ne '' ) {
2575
                    $newfield = MARC::Field->new( $tag, $cgi->param( $params[ $j + 1 ] ), );
2576
                    $newfield = MARC::Field->new( $tag, $fval, );
2576
                }
2577
                }
2577
2578
2578
                # > 009, deal with subfields
2579
                # > 009, deal with subfields
Lines 2586-2598 sub TransformHtmlToMarc { Link Here
2586
                    #if next param ne subfield, then it was probably empty
2587
                    #if next param ne subfield, then it was probably empty
2587
                    #try next param by incrementing j
2588
                    #try next param by incrementing j
2588
                    if($params[$j+1]!~/_subfield_/) {$j++; next; }
2589
                    if($params[$j+1]!~/_subfield_/) {$j++; next; }
2590
                    my $fkey= $cgi->param($params[$j]);
2589
                    my $fval= $cgi->param($params[$j+1]);
2591
                    my $fval= $cgi->param($params[$j+1]);
2590
                    #check if subfield value not empty and field exists
2592
                    #check if subfield value not empty and field exists
2591
                    if($fval ne '' && $newfield) {
2593
                    if($fval ne '' && $newfield) {
2592
                        $newfield->add_subfields( $cgi->param($params[$j]) => $fval);
2594
                        $newfield->add_subfields( $fkey => $fval);
2593
                    }
2595
                    }
2594
                    elsif($fval ne '') {
2596
                    elsif($fval ne '') {
2595
                        $newfield = MARC::Field->new( $tag, $ind1, $ind2, $cgi->param($params[$j]) => $fval );
2597
                        $newfield = MARC::Field->new( $tag, $ind1, $ind2, $fkey => $fval );
2596
                    }
2598
                    }
2597
                    $j += 2;
2599
                    $j += 2;
2598
                } #end-of-while
2600
                } #end-of-while
2599
- 

Return to bug 16809