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.13,1.14


From: Gynn Lomax
Subject: [Koha-cvs] CVS: koha/C4 Acquisitions.pm,1.13,1.14
Date: Mon, 13 May 2002 21:12:54 -0700

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

Modified Files:
        Acquisitions.pm 
Log Message:
Added code to allow deleting of biblioitems


Index: Acquisitions.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Acquisitions.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** Acquisitions.pm     13 May 2002 20:32:36 -0000      1.13
--- Acquisitions.pm     14 May 2002 04:12:52 -0000      1.14
***************
*** 16,20 ****
  &bookfundbreakdown &curconvert &updatesup &insertsup &newitems &modbibitem
  &getcurrencies &modsubtitle &modsubject &modaddauthor &moditem &countitems 
! &findall &needsmod &delitem &delbibitem &delbiblio &delorder &branches
  &getallorders &getrecorders &updatecurrencies &getorder &getcurrency 
&updaterecorder
  &updatecost &checkitems &modnote &getitemtypes &getbiblio
--- 16,20 ----
  &bookfundbreakdown &curconvert &updatesup &insertsup &newitems &modbibitem
  &getcurrencies &modsubtitle &modsubject &modaddauthor &moditem &countitems 
! &findall &needsmod &delitem &deletebiblioitem &delbiblio &delorder &branches
  &getallorders &getrecorders &updatecurrencies &getorder &getcurrency 
&updaterecorder
  &updatecost &checkitems &modnote &getitemtypes &getbiblio
***************
*** 1116,1145 ****
  }
  
! sub delbibitem{
!   my ($itemnum)address@hidden;
!   my $dbh=C4Connect;
!   my $query="select * from biblioitems where biblioitemnumber=$itemnum";
!   my $sth=$dbh->prepare($query);
!   $sth->execute;
!   if (my @data=$sth->fetchrow_array){
!     $sth->finish;
!     $query="Insert into deletedbiblioitems values (";
!     foreach my $temp (@data){
!       $temp=~ s/\'/\\\'/g;
!       $query=$query."'$temp',";
!     }
!     $query=~ s/\,$/\)/;
! #   print $query;
!     $sth=$dbh->prepare($query);
      $sth->execute;
      $sth->finish;
!     $query = "Delete from biblioitems where biblioitemnumber=$itemnum";
!     $sth=$dbh->prepare($query);
      $sth->execute;
      $sth->finish;
!   }
!   $sth->finish;
!   $dbh->disconnect;
! }
  
  sub delbiblio{
--- 1116,1175 ----
  }
  
! 
! sub deletebiblioitem {
!     my ($biblioitemnumber) = @_;
!     my $dbh   = C4Connect;
!     my $query = "Select * from biblioitems
! where biblioitemnumber = $biblioitemnumber";
!     my $sth   = $dbh->prepare($query);
!     my @results;
! 
      $sth->execute;
+   
+     if (@results = $sth->fetchrow_array) {
+ 
+         $query = "Insert into deletedbiblioitems values (";
+         foreach my $value (@results) {
+             $value  = $dbh->quote($value);
+             $query .= "$value,";
+         } # foreach
+ 
+         $query =~ s/\,$/\)/;
+         $dbh->do($query);
+ 
+         $query = "Delete from biblioitems
+ where biblioitemnumber = $biblioitemnumber";
+         $dbh->do($query);
+     } # if
+ 
      $sth->finish;
! 
! # Now delete all the items attached to the biblioitem
! 
!     $query = "Select * from items where biblioitemnumber = $biblioitemnumber";
!     $sth   = $dbh->prepare($query);
! 
      $sth->execute;
+ 
+     while (@results = $sth->fetchrow_array) {
+ 
+       $query = "Insert into deleteditems values (";
+       foreach my $value (@results) {
+           $value  = $dbh->quote($value);
+           $query .= "$value,";
+       } # foreach
+ 
+       $query =~ s/\,$/\)/;
+       $dbh->do($query);
+     } # while
+ 
      $sth->finish;
! 
!     $query = "Delete from items where biblioitemnumber = $biblioitemnumber";
!     $dbh->do($query);
!     
!     $dbh->disconnect;
! } # sub deletebiblioitem
! 
  
  sub delbiblio{




reply via email to

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