(MT 2671): Serial management in koha_add_biblio
authorPaul Poulain <paul.poulain@biblibre.com>
Fri, 22 Jan 2010 16:02:17 +0000 (17:02 +0100)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Thu, 28 Jan 2010 14:11:56 +0000 (15:11 +0100)
serial management in koha_add_biblio is only relying on presence of
$biblio->{seriestitle} It is not correct, $biblio->{serial} definition
should prevail over this test

C4/Biblio.pm

index 8b918db..ded50fc 100755 (executable)
@@ -2971,8 +2971,10 @@ sub _koha_add_biblio {
     my $error;
 
     # set the series flag
-    my $serial = 0;
-    if ( $biblio->{'seriestitle'} ) { $serial = 1 }
+    unless (defined $biblio->{'serial'}){
+       $biblio->{'serial'} = 0;
+       if ( $biblio->{'seriestitle'} ) { $biblio->{'serial'} = 1 }
+    }
 
     my $query = "INSERT INTO biblio
         SET frameworkcode = ?,
@@ -2989,7 +2991,7 @@ sub _koha_add_biblio {
     my $sth = $dbh->prepare($query);
     $sth->execute(
         $frameworkcode, $biblio->{'author'},      $biblio->{'title'},         $biblio->{'unititle'}, $biblio->{'notes'},
-        $serial,        $biblio->{'seriestitle'}, $biblio->{'copyrightdate'}, $biblio->{'abstract'}
+        $biblio->{'serial'},        $biblio->{'seriestitle'}, $biblio->{'copyrightdate'}, $biblio->{'abstract'}
     );
 
     my $biblionumber = $dbh->{'mysql_insertid'};