[Koha-cvs] koha modrequest.pl C4/Reserves2.pm [dev_week]

Chris Cormack crc at liblime.com
Sat Aug 4 17:54:39 CEST 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		dev_week
Changes by:	Chris Cormack <rangi>	07/08/04 15:54:39

Modified files:
	.              : modrequest.pl 
	C4             : Reserves2.pm 

Log message:
	Fixes for updating reserves

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/modrequest.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.6&r2=1.6.4.1
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Reserves2.pm?cvsroot=koha&only_with_tag=dev_week&r1=1.38.4.5&r2=1.38.4.6

Patches:
Index: modrequest.pl
===================================================================
RCS file: /sources/koha/koha/Attic/modrequest.pl,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -u -b -r1.6 -r1.6.4.1
--- modrequest.pl	21 Jun 2004 21:40:33 -0000	1.6
+++ modrequest.pl	4 Aug 2007 15:54:38 -0000	1.6.4.1
@@ -39,11 +39,13 @@
 my @borrower=$input->param('borrowernumber');
 my @branch=$input->param('pickup');
 my $count=@rank;
+my @itemnumber=$input->param('itemnumber');
 
 # goes through and manually changes the reserves record....
 # no attempt is made to check consistency.
 for (my $i=0;$i<$count;$i++){
-    UpdateReserve($rank[$i],$biblio[$i],$borrower[$i],$branch[$i]); #from C4::Reserves2
+    UpdateReserve($rank[$i],$biblio[$i],$borrower[$i],$branch[$i],$itemnumber[$i]); #from C4::Reserves2
+	  
 }
 
 my $from=$input->param('from');

Index: C4/Reserves2.pm
===================================================================
RCS file: /sources/koha/koha/C4/Attic/Reserves2.pm,v
retrieving revision 1.38.4.5
retrieving revision 1.38.4.6
diff -u -b -r1.38.4.5 -r1.38.4.6
--- C4/Reserves2.pm	21 Jun 2007 23:27:39 -0000	1.38.4.5
+++ C4/Reserves2.pm	4 Aug 2007 15:54:38 -0000	1.38.4.6
@@ -3,7 +3,7 @@
 
 package C4::Reserves2;
 
-# $Id: Reserves2.pm,v 1.38.4.5 2007/06/21 23:27:39 rangi Exp $
+# $Id: Reserves2.pm,v 1.38.4.6 2007/08/04 15:54:38 rangi Exp $
 
 # Copyright 2000-2002 Katipo Communications
 # Copyright 2007 Liblime
@@ -766,15 +766,28 @@
     my ($rank,$biblio,$borrower,$branch,$itemnumber)=@_;
     return if $rank eq "W";
     return if $rank eq "n";
+	if (!$itemnumber){
+		$itemnumber=0;
+	}
     my $dbh = C4::Context->dbh;
 	if ( $rank eq "del" ) {
 		if ( C4::Context->preference('itemlevelreserves') ) {
+			if ($itemnumber == 0){
+				my $sth = $dbh->prepare( "UPDATE reserves SET cancellationdate=now() WHERE biblionumber=? AND borrowernumber=?
+                AND cancellationdate is NULL 
+                AND (found <> 'F' or found is NULL) AND (itemnumber is NULL or itemnumber = 0)"
+                );
+                $sth->execute( $biblio, $borrower );
+                $sth->finish();
+            }
+            else {
 			my $sth = $dbh->prepare(
 				"UPDATE reserves SET cancellationdate=now() WHERE itemnumber=? AND borrowernumber=? AND cancellationdate is NULL AND (found <> 'F' or found is NULL)"
 			);
             $sth->execute( $itemnumber, $borrower );
             $sth->finish();
         }
+        }
         else {
 			my $sth = $dbh->prepare(
 				"UPDATE reserves SET cancellationdate=now() WHERE biblionumber   = ? AND borrowernumber = ? AND cancellationdate is NULL AND (found <> 'F' or found is NULL)" 
@@ -785,12 +798,22 @@
     }
 	else {
 		if ( C4::Context->preference('itemlevelreserves') ) { 
+			if ($itemnumber == 0){
+				my $sth = $dbh->prepare(
+				"UPDATE reserves SET priority = ? ,branchcode = ? WHERE biblionumber   = ? AND borrowernumber = ?  AND cancellationdate is NULL AND (found <> 'F' or found is NULL) AND (itemnumber is NULL or itemnumber = 0) limit 1"
+				);				
+				$sth->execute( $rank, $branch, $biblio, $borrower ); 
+				$sth->finish;
+			}
+			else {
 			my $sth = $dbh->prepare(
 				"UPDATE reserves SET priority = ? ,branchcode = ? WHERE biblionumber   = ? AND borrowernumber = ? AND itemnumber= ? AND cancellationdate is NULL AND (found <> 'F' or found is NULL)"
 			);
+				warn $itemnumber;
             $sth->execute( $rank, $branch, $biblio, $borrower, $itemnumber ); 
             $sth->finish;
 		}
+		}
         else {
 			my $sth = $dbh->prepare(
 				"UPDATE reserves SET priority = ? ,branchcode = ?, itemnumber = NULL, found = NULL WHERE biblionumber   = ? AND borrowernumber = ? AND cancellationdate is NULL AND (found <> 'F' or found is NULL)"





More information about the Koha-cvs mailing list