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

(-)a/C4/Biblio.pm (-5 / +11 lines)
Lines 2496-2502 sub _default_ind_to_space { Link Here
2496
=cut
2496
=cut
2497
2497
2498
sub TransformHtmlToMarc {
2498
sub TransformHtmlToMarc {
2499
    my $cgi    = shift;
2499
    my ($cgi, $isbiblio) = @_;
2500
2500
2501
    my @params = $cgi->param();
2501
    my @params = $cgi->param();
2502
2502
Lines 2517-2523 sub TransformHtmlToMarc { Link Here
2517
    my $record = MARC::Record->new();
2517
    my $record = MARC::Record->new();
2518
    my $i      = 0;
2518
    my $i      = 0;
2519
    my @fields;
2519
    my @fields;
2520
    my ( $biblionumbertagfield, $biblionumbertagsubfield ) = &GetMarcFromKohaField( "biblio.biblionumber", '' );
2520
    my ($biblionumbertagfield, $biblionumbertagsubfield) = (-1, -1);
2521
    ($biblionumbertagfield, $biblionumbertagsubfield) =
2522
        &GetMarcFromKohaField( "biblio.biblionumber", '' ) if $isbiblio;
2521
#FIXME This code assumes that the CGI params will be in the same order as the fields in the template; this is no absolute guarantee!
2523
#FIXME This code assumes that the CGI params will be in the same order as the fields in the template; this is no absolute guarantee!
2522
    while ( $params[$i] ) {    # browse all CGI params
2524
    while ( $params[$i] ) {    # browse all CGI params
2523
        my $param    = $params[$i];
2525
        my $param    = $params[$i];
Lines 2541-2548 sub TransformHtmlToMarc { Link Here
2541
2543
2542
            if ( $tag < 10 ) {                              # no code for theses fields
2544
            if ( $tag < 10 ) {                              # no code for theses fields
2543
                                                            # in MARC editor, 000 contains the leader.
2545
                                                            # in MARC editor, 000 contains the leader.
2544
                next if $tag == $biblionumbertagfield;
2546
                if ( $tag == $biblionumbertagfield ) {
2545
                if ( $tag eq '000' ) {
2547
                    # We do nothing and let $i be incremented
2548
                }
2549
                elsif ( $tag eq '000' ) {
2546
                    # Force a fake leader even if not provided to avoid crashing
2550
                    # Force a fake leader even if not provided to avoid crashing
2547
                    # during decoding MARC record containing UTF-8 characters
2551
                    # during decoding MARC record containing UTF-8 characters
2548
                    $record->leader(
2552
                    $record->leader(
Lines 2561-2567 sub TransformHtmlToMarc { Link Here
2561
                # browse subfields for this tag (reason for _code_ match)
2565
                # browse subfields for this tag (reason for _code_ match)
2562
                while(defined $params[$j] && $params[$j] =~ /_code_/) {
2566
                while(defined $params[$j] && $params[$j] =~ /_code_/) {
2563
                    last unless defined $params[$j+1];
2567
                    last unless defined $params[$j+1];
2564
                    $j += 2 and next if $tag == $biblionumbertagfield and $cgi->param($params[$j]) eq $biblionumbertagsubfield;
2568
                    $j += 2 and next
2569
                        if $tag == $biblionumbertagfield and
2570
                           $cgi->param($params[$j]) eq $biblionumbertagsubfield;
2565
                    #if next param ne subfield, then it was probably empty
2571
                    #if next param ne subfield, then it was probably empty
2566
                    #try next param by incrementing j
2572
                    #try next param by incrementing j
2567
                    if($params[$j+1]!~/_subfield_/) {$j++; next; }
2573
                    if($params[$j+1]!~/_subfield_/) {$j++; next; }
(-)a/authorities/authorities.pl (-1 / +1 lines)
Lines 612-618 if ($op eq "add") { Link Here
612
    # build indicator hash.
612
    # build indicator hash.
613
    my @ind_tag = $input->param('ind_tag');
613
    my @ind_tag = $input->param('ind_tag');
614
    my @indicator = $input->param('indicator');
614
    my @indicator = $input->param('indicator');
615
    my $record = TransformHtmlToMarc($input);
615
    my $record = TransformHtmlToMarc($input, 0);
616
616
617
    my ($duplicateauthid,$duplicateauthvalue);
617
    my ($duplicateauthid,$duplicateauthvalue);
618
     ($duplicateauthid,$duplicateauthvalue) = FindDuplicateAuthority($record,$authtypecode) if ($op eq "add") && (!$is_a_modif);
618
     ($duplicateauthid,$duplicateauthvalue) = FindDuplicateAuthority($record,$authtypecode) if ($op eq "add") && (!$is_a_modif);
(-)a/authorities/merge.pl (-1 / +1 lines)
Lines 49-55 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
49
if ($merge) {
49
if ($merge) {
50
50
51
    # Creating a new record from the html code
51
    # Creating a new record from the html code
52
    my $record   = TransformHtmlToMarc($input);
52
    my $record   = TransformHtmlToMarc($input, 0);
53
    my $recordid1   = $input->param('recordid1');
53
    my $recordid1   = $input->param('recordid1');
54
    my $recordid2   = $input->param('recordid2');
54
    my $recordid2   = $input->param('recordid2');
55
    my $typecode = $input->param('frameworkcode');
55
    my $typecode = $input->param('frameworkcode');
(-)a/cataloguing/addbiblio.pl (-2 / +2 lines)
Lines 834-840 if ( $op eq "addbiblio" ) { Link Here
834
    );
834
    );
835
    # getting html input
835
    # getting html input
836
    my @params = $input->param();
836
    my @params = $input->param();
837
    $record = TransformHtmlToMarc( $input );
837
    $record = TransformHtmlToMarc( $input, 1 );
838
    # check for a duplicate
838
    # check for a duplicate
839
    my ( $duplicatebiblionumber, $duplicatetitle );
839
    my ( $duplicatebiblionumber, $duplicatetitle );
840
    if ( !$is_a_modif ) {
840
    if ( !$is_a_modif ) {
Lines 948-954 elsif ( $op eq "delete" ) { Link Here
948
    }
948
    }
949
949
950
    if($changed_framework eq "changed"){
950
    if($changed_framework eq "changed"){
951
        $record = TransformHtmlToMarc( $input );
951
        $record = TransformHtmlToMarc( $input, 1 );
952
    }
952
    }
953
    elsif( $record ne -1 ) {
953
    elsif( $record ne -1 ) {
954
#FIXME: it's kind of silly to go from MARC::Record to MARC::File::XML and then back again just to fix the encoding
954
#FIXME: it's kind of silly to go from MARC::Record to MARC::File::XML and then back again just to fix the encoding
(-)a/cataloguing/merge.pl (-2 / +1 lines)
Lines 55-61 if ($merge) { Link Here
55
    my $dbh = C4::Context->dbh;
55
    my $dbh = C4::Context->dbh;
56
56
57
    # Creating a new record from the html code
57
    # Creating a new record from the html code
58
    my $record       = TransformHtmlToMarc( $input );
58
    my $record       = TransformHtmlToMarc( $input, 1 );
59
    my $ref_biblionumber = $input->param('ref_biblionumber');
59
    my $ref_biblionumber = $input->param('ref_biblionumber');
60
    @biblionumbers = grep { $_ != $ref_biblionumber } @biblionumbers;
60
    @biblionumbers = grep { $_ != $ref_biblionumber } @biblionumbers;
61
61
62
- 

Return to bug 15572