Revert "Bug 15572: Follow-up to fix error on authority creation"
authorJesse Weaver <jweaver@bywatersolutions.com>
Mon, 25 Jan 2016 14:01:28 +0000 (07:01 -0700)
committerJesse Weaver <jweaver@bywatersolutions.com>
Mon, 25 Jan 2016 14:09:50 +0000 (07:09 -0700)
This reverts commit 2ca9bd5dc247ae26225cbc299c1bc0883bc444e0.

C4/Biblio.pm
authorities/authorities.pl
authorities/merge.pl
cataloguing/addbiblio.pl
cataloguing/merge.pl

index ef263e4..5ecae00 100644 (file)
@@ -2496,7 +2496,7 @@ sub _default_ind_to_space {
 =cut
 
 sub TransformHtmlToMarc {
-    my ($cgi, $isbiblio) = @_;
+    my $cgi    = shift;
 
     my @params = $cgi->param();
 
@@ -2516,9 +2516,7 @@ sub TransformHtmlToMarc {
     # creating a new record
     my $record = MARC::Record->new();
     my @fields;
-    my ($biblionumbertagfield, $biblionumbertagsubfield) = (-1, -1);
-    ($biblionumbertagfield, $biblionumbertagsubfield) =
-        &GetMarcFromKohaField( "biblio.biblionumber", '' ) if $isbiblio;
+    my ( $biblionumbertagfield, $biblionumbertagsubfield ) = &GetMarcFromKohaField( "biblio.biblionumber", '' );
 #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!
     for (my $i = 0; $params[$i]; $i++ ) {    # browse all CGI params
         my $param    = $params[$i];
@@ -2542,10 +2540,8 @@ sub TransformHtmlToMarc {
 
             if ( $tag < 10 ) {                              # no code for theses fields
                                                             # in MARC editor, 000 contains the leader.
-                if ( $tag == $biblionumbertagfield ) {
-                    # We do nothing and let $i be incremented
-                }
-                elsif ( $tag eq '000' ) {
+                next if $tag == $biblionumbertagfield;
+                if ( $tag eq '000' ) {
                     # Force a fake leader even if not provided to avoid crashing
                     # during decoding MARC record containing UTF-8 characters
                     $record->leader(
@@ -2564,9 +2560,7 @@ 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 $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; }
index ca3b0d3..2eba66e 100755 (executable)
@@ -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, 0);
+    my $record = TransformHtmlToMarc($input);
 
     my ($duplicateauthid,$duplicateauthvalue);
      ($duplicateauthid,$duplicateauthvalue) = FindDuplicateAuthority($record,$authtypecode) if ($op eq "add") && (!$is_a_modif);
index cfc1ca5..f34e55c 100755 (executable)
@@ -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, 0);
+    my $record   = TransformHtmlToMarc($input);
     my $recordid1   = $input->param('recordid1');
     my $recordid2   = $input->param('recordid2');
     my $typecode = $input->param('frameworkcode');
index e34557c..b6805c9 100755 (executable)
@@ -834,7 +834,7 @@ if ( $op eq "addbiblio" ) {
     );
     # getting html input
     my @params = $input->param();
-    $record = TransformHtmlToMarc( $input, 1 );
+    $record = TransformHtmlToMarc( $input );
     # 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, 1 );
+        $record = TransformHtmlToMarc( $input );
     }
     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
index a882daa..490eaa1 100755 (executable)
@@ -55,7 +55,7 @@ if ($merge) {
     my $dbh = C4::Context->dbh;
 
     # Creating a new record from the html code
-    my $record       = TransformHtmlToMarc( $input, 1 );
+    my $record       = TransformHtmlToMarc( $input );
     my $ref_biblionumber = $input->param('ref_biblionumber');
     @biblionumbers = grep { $_ != $ref_biblionumber } @biblionumbers;