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

(-)a/C4/Biblio.pm (-7 / +8 lines)
Lines 2574-2591 sub TransformHtmlToMarc { Link Here
2574
            if ( $tag < 10 ) {                              # no code for theses fields
2574
            if ( $tag < 10 ) {                              # no code for theses fields
2575
                                                            # in MARC editor, 000 contains the leader.
2575
                                                            # in MARC editor, 000 contains the leader.
2576
                next if $tag == $biblionumbertagfield;
2576
                next if $tag == $biblionumbertagfield;
2577
                my $fval= $cgi->param($params[$j+1]);
2577
                if ( $tag eq '000' ) {
2578
                if ( $tag eq '000' ) {
2578
                    # Force a fake leader even if not provided to avoid crashing
2579
                    # Force a fake leader even if not provided to avoid crashing
2579
                    # during decoding MARC record containing UTF-8 characters
2580
                    # during decoding MARC record containing UTF-8 characters
2580
                    $record->leader(
2581
                    $record->leader(
2581
                        length( $cgi->param($params[$j+1]) ) == 24
2582
                        length( $fval ) == 24
2582
                        ? $cgi->param( $params[ $j + 1 ] )
2583
                        ? $fval
2583
                        : '     nam a22        4500'
2584
                        : '     nam a22        4500'
2584
			)
2585
			)
2585
                    ;
2586
                    ;
2586
                    # between 001 and 009 (included)
2587
                    # between 001 and 009 (included)
2587
                } elsif ( $cgi->param( $params[ $j + 1 ] ) ne '' ) {
2588
                } elsif ( $fval ne '' ) {
2588
                    $newfield = MARC::Field->new( $tag, $cgi->param( $params[ $j + 1 ] ), );
2589
                    $newfield = MARC::Field->new( $tag, $fval, );
2589
                }
2590
                }
2590
2591
2591
                # > 009, deal with subfields
2592
                # > 009, deal with subfields
Lines 2599-2611 sub TransformHtmlToMarc { Link Here
2599
                    #if next param ne subfield, then it was probably empty
2600
                    #if next param ne subfield, then it was probably empty
2600
                    #try next param by incrementing j
2601
                    #try next param by incrementing j
2601
                    if($params[$j+1]!~/_subfield_/) {$j++; next; }
2602
                    if($params[$j+1]!~/_subfield_/) {$j++; next; }
2603
                    my $fkey= $cgi->param($params[$j]);
2602
                    my $fval= $cgi->param($params[$j+1]);
2604
                    my $fval= $cgi->param($params[$j+1]);
2603
                    #check if subfield value not empty and field exists
2605
                    #check if subfield value not empty and field exists
2604
                    if($fval ne '' && $newfield) {
2606
                    if($fval ne '' && $newfield) {
2605
                        $newfield->add_subfields( $cgi->param($params[$j]) => $fval);
2607
                        $newfield->add_subfields( $fkey => $fval);
2606
                    }
2608
                    }
2607
                    elsif($fval ne '') {
2609
                    elsif($fval ne '') {
2608
                        $newfield = MARC::Field->new( $tag, $ind1, $ind2, $cgi->param($params[$j]) => $fval );
2610
                        $newfield = MARC::Field->new( $tag, $ind1, $ind2, $fkey => $fval );
2609
                    }
2611
                    }
2610
                    $j += 2;
2612
                    $j += 2;
2611
                } #end-of-while
2613
                } #end-of-while
2612
- 

Return to bug 16809