koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/C4 Acquisitions.pm,1.5.2.7,1.5.2.8


From: Alan Millar
Subject: [Koha-cvs] CVS: koha/C4 Acquisitions.pm,1.5.2.7,1.5.2.8
Date: Thu, 30 May 2002 22:30:50 -0700

Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv18124

Modified Files:
      Tag: rel-1-2
        Acquisitions.pm 
Log Message:
Error handling in biblio and biblioitem addition


Index: Acquisitions.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Acquisitions.pm,v
retrieving revision 1.5.2.7
retrieving revision 1.5.2.8
diff -C2 -r1.5.2.7 -r1.5.2.8
*** Acquisitions.pm     29 May 2002 15:08:49 -0000      1.5.2.7
--- Acquisitions.pm     31 May 2002 05:30:48 -0000      1.5.2.8
***************
*** 386,400 ****
        
  
  sub newbiblio {
!   my ($biblio) = @_;
    my $dbh    = &C4Connect;
    my $query  = "Select max(biblionumber) from biblio";
    my $sth    = $dbh->prepare($query);
    $sth->execute;
    my $data   = $sth->fetchrow_arrayref;
!   my $bibnum = $$data[0] + 1;
!   my $series;
  
!   if ($biblio->{'seriestitle'}) { $series = 1 } else { $series = 0 };
  
    $sth->finish;
--- 386,408 ----
        
  
+ # Create a new biblio entry
  sub newbiblio {
!   my ($biblio) = @_;  # input is ref to hash of fields
!   my ($bibnum,$error);                # return resulting biblio number
! 
!   $error="";
! 
    my $dbh    = &C4Connect;
+ 
+   # Get next biblionumber in sequence
    my $query  = "Select max(biblionumber) from biblio";
    my $sth    = $dbh->prepare($query);
    $sth->execute;
    my $data   = $sth->fetchrow_arrayref;
!   $bibnum = $$data[0] + 1;
  
!   my $serial;         # is this item part of a series?
! 
!   if ($biblio->{'seriestitle'}) { $serial = 1 } else { $serial = 0 };
  
    $sth->finish;
***************
*** 404,408 ****
        author        = ?,
        copyrightdate = ?,
!       series        = ?,
        seriestitle   = ?,
        notes         = ?   ";
--- 412,416 ----
        author        = ?,
        copyrightdate = ?,
!       serial        = ?,
        seriestitle   = ?,
        notes         = ?   ";
***************
*** 410,426 ****
  #  print $query;
    $sth = $dbh->prepare($query);
!   $sth->execute(
      $bibnum,
      $biblio->{'title'},
      $biblio->{'author'},
      $biblio->{'copyright'},
!     $series,
      $biblio->{'seriestitle'} ,
      $biblio->{'notes'}           
!   ) ;
  
    $sth->finish;
    $dbh->disconnect;
!   return($bibnum);
  }
  
--- 418,440 ----
  #  print $query;
    $sth = $dbh->prepare($query);
!   if (  $sth->execute(
      $bibnum,
      $biblio->{'title'},
      $biblio->{'author'},
      $biblio->{'copyright'},
!     $serial,
      $biblio->{'seriestitle'} ,
      $biblio->{'notes'}           
!   )  ) {
!       $error='';
!   } else {
!       $error=$sth->errstr;
!       $bibnum = ""; 
!   } # if exec error
  
    $sth->finish;
    $dbh->disconnect;
! 
!   return($bibnum,$error);
  }
  
***************
*** 941,945 ****
      $sth->execute;
  
!     $error.=$sth->errstr;
  
      $sth->finish;
--- 955,959 ----
      $sth->execute;
  
!     $error=$sth->errstr;
  
      $sth->finish;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]