[Koha-cvs] CVS: koha/C4 Reserves2.pm,1.19,1.20

Finlay Thompson finlayt at users.sourceforge.net
Fri Sep 27 07:21:46 CEST 2002


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

Modified Files:
	Reserves2.pm 
Log Message:

Added the possiblity of deleting waiting reservesm or setting them back to not waiting.
uses UpdateReserve now, instead of updatereserves from Reserves2.pm



Index: Reserves2.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Reserves2.pm,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** Reserves2.pm	4 Sep 2002 22:51:39 -0000	1.19
--- Reserves2.pm	27 Sep 2002 05:21:44 -0000	1.20
***************
*** 32,36 ****
      
  @ISA = qw(Exporter);
! @EXPORT = qw(&FindReserves &CheckReserves &CheckWaiting &CancelReserve &FillReserve &ReserveWaiting &CreateReserve &updatereserves &getreservetitle &Findgroupreserve);
  						    
  # make all your functions, whether exported or not;
--- 32,36 ----
      
  @ISA = qw(Exporter);
! @EXPORT = qw(&FindReserves &CheckReserves &CheckWaiting &CancelReserve &FillReserve &ReserveWaiting &CreateReserve &updatereserves &UpdateReserve &getreservetitle &Findgroupreserve);
  						    
  # make all your functions, whether exported or not;
***************
*** 511,515 ****
    my $dbh=C4Connect;
    my $query="Update reserves ";
!   if ($del ==0){
      $query.="set  priority='$rank',branchcode='$branch' where
      biblionumber=$biblio and borrowernumber=$borrower";
--- 511,515 ----
    my $dbh=C4Connect;
    my $query="Update reserves ";
!   if ($del == 0){
      $query.="set  priority='$rank',branchcode='$branch' where
      biblionumber=$biblio and borrowernumber=$borrower";
***************
*** 543,546 ****
--- 543,572 ----
    $sth->finish;  
    $dbh->disconnect;
+ }
+ sub UpdateReserve {
+     #subroutine to update a reserve 
+     my ($rank,$biblio,$borrower,$branch)=@_;
+     return if $rank eq "W";
+     my $dbh=C4Connect;
+     if ($rank eq "del") {
+ 	my $query = "UPDATE reserves SET cancellationdate=now() 
+                                    WHERE biblionumber   = ? 
+                                      AND borrowernumber = ?    
+ 	                             AND cancellationdate is NULL
+                                      AND (found <> 'F' or found is NULL)";
+ 	my $sth=$dbh->prepare($query);
+ 	$sth->execute($biblio, $borrower);
+ 	$sth->finish;  
+     } else {
+ 	my $query = "UPDATE reserves SET priority = ? ,branchcode = ?, itemnumber = NULL, found = NULL 
+                                    WHERE biblionumber   = ? 
+                                      AND borrowernumber = ?
+ 	                             AND cancellationdate is NULL
+                                      AND (found <> 'F' or found is NULL)";
+ 	my $sth=$dbh->prepare($query);
+ 	$sth->execute($rank, $branch, $biblio, $borrower);
+ 	$sth->finish;  
+     }
+     $dbh->disconnect;
  }
  





More information about the Koha-cvs mailing list