@@ -, +, @@ --- C4/Biblio.pm | 10 +++++++--- authorities/authorities.pl | 2 +- authorities/merge.pl | 2 +- cataloguing/addbiblio.pl | 4 ++-- cataloguing/merge.pl | 2 +- 5 files changed, 12 insertions(+), 8 deletions(-) --- a/C4/Biblio.pm +++ a/C4/Biblio.pm @@ -2496,7 +2496,7 @@ sub _default_ind_to_space { =cut sub TransformHtmlToMarc { - my $cgi = shift; + my ($cgi, $isbiblio) = @_; my @params = $cgi->param(); @@ -2541,7 +2541,9 @@ sub TransformHtmlToMarc { if ( $tag < 10 ) { # no code for theses fields # in MARC editor, 000 contains the leader. - next if $tag == $biblionumbertagfield; + if ( $isbiblio && $tag == $biblionumbertagfield ) { + # We do nothing and let $i be incremented + } if ( $tag eq '000' ) { # Force a fake leader even if not provided to avoid crashing # during decoding MARC record containing UTF-8 characters @@ -2561,7 +2563,9 @@ sub TransformHtmlToMarc { # browse subfields for this tag (reason for _code_ match) while(defined $params[$j] && $params[$j] =~ /_code_/) { last unless defined $params[$j+1]; - $j += 2 and next if $tag == $biblionumbertagfield and $cgi->param($params[$j]) eq $biblionumbertagsubfield; + $j += 2 and next + if $isbiblio and $tag == $biblionumbertagfield and + $cgi->param($params[$j]) eq $biblionumbertagsubfield; #if next param ne subfield, then it was probably empty #try next param by incrementing j if($params[$j+1]!~/_subfield_/) {$j++; next; } --- a/authorities/authorities.pl +++ a/authorities/authorities.pl @@ -612,7 +612,7 @@ if ($op eq "add") { # build indicator hash. my @ind_tag = $input->param('ind_tag'); my @indicator = $input->param('indicator'); - my $record = TransformHtmlToMarc($input); + my $record = TransformHtmlToMarc($input, 0); my ($duplicateauthid,$duplicateauthvalue); ($duplicateauthid,$duplicateauthvalue) = FindDuplicateAuthority($record,$authtypecode) if ($op eq "add") && (!$is_a_modif); --- a/authorities/merge.pl +++ a/authorities/merge.pl @@ -49,7 +49,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( if ($merge) { # Creating a new record from the html code - my $record = TransformHtmlToMarc($input); + my $record = TransformHtmlToMarc($input, 0); my $recordid1 = $input->param('recordid1'); my $recordid2 = $input->param('recordid2'); my $typecode = $input->param('frameworkcode'); --- a/cataloguing/addbiblio.pl +++ a/cataloguing/addbiblio.pl @@ -834,7 +834,7 @@ if ( $op eq "addbiblio" ) { ); # getting html input my @params = $input->param(); - $record = TransformHtmlToMarc( $input ); + $record = TransformHtmlToMarc( $input, 1 ); # check for a duplicate my ( $duplicatebiblionumber, $duplicatetitle ); if ( !$is_a_modif ) { @@ -948,7 +948,7 @@ elsif ( $op eq "delete" ) { } if($changed_framework eq "changed"){ - $record = TransformHtmlToMarc( $input ); + $record = TransformHtmlToMarc( $input, 1 ); } elsif( $record ne -1 ) { #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 +++ a/cataloguing/merge.pl @@ -55,7 +55,7 @@ if ($merge) { my $dbh = C4::Context->dbh; # Creating a new record from the html code - my $record = TransformHtmlToMarc( $input ); + my $record = TransformHtmlToMarc( $input, 1 ); my $ref_biblionumber = $input->param('ref_biblionumber'); @biblionumbers = grep { $_ != $ref_biblionumber } @biblionumbers; --