Patch from Galen Charlton, removing $Id$ $Log$ and $Revision$ from files
[koha.git] / C4 / Reserves.pm
old mode 100755 (executable)
new mode 100644 (file)
index a2c9d3a..9e8398f
@@ -22,7 +22,6 @@ package C4::Reserves;
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id$
 
 use strict;
 require Exporter;
@@ -37,7 +36,7 @@ our ($VERSION,@ISA,@EXPORT,@EXPORT_OK,%EXPORT_TAGS);
 my $library_name = C4::Context->preference("LibraryName");
 
 # set the version for version checking
-$VERSION = do { my @v = '$Revision$' =~ /\d+/g; shift(@v) . "." . join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = 3.00;
 
 =head1 NAME
 
@@ -430,9 +429,9 @@ sub GetReserveFee {
     my $dbh   = C4::Context->dbh;
     my $const = lc substr( $constraint, 0, 1 );
     my $query = qq/
-      SELECT * FROM borrowers,categories
+      SELECT * FROM borrowers
+    LEFT JOIN categories ON borrowers.categorycode = categories.categorycode
     WHERE borrowernumber = ?
-      AND borrowers.categorycode = categories.categorycode
     /;
     my $sth = $dbh->prepare($query);
     $sth->execute($borrowernumber);
@@ -447,9 +446,8 @@ sub GetReserveFee {
         # first find biblioitem records
         my @biblioitems;
         my $sth1 = $dbh->prepare(
-            "SELECT * FROM biblio,biblioitems
-                   WHERE (biblio.biblionumber = ?)
-                     AND (biblio.biblionumber = biblioitems.biblionumber)"
+            "SELECT * FROM biblio LEFT JOIN biblioitems on biblio.biblionumber = biblioitems.biblionumber
+                   WHERE (biblio.biblionumber = ?)"
         );
         $sth1->execute($biblionumber);
         while ( my $data1 = $sth1->fetchrow_hashref ) {
@@ -612,10 +610,10 @@ sub CheckReserves {
         # Look up the item by itemnumber
         my $query = "
             SELECT items.biblionumber, items.biblioitemnumber, itemtypes.notforloan
-            FROM   items, biblioitems, itemtypes
-            WHERE  items.biblioitemnumber = biblioitems.biblioitemnumber
-               AND biblioitems.itemtype = itemtypes.itemtype
-               AND itemnumber=$qitem
+            FROM   items
+            LEFT JOIN biblioitems ON items.biblioitemnumber = biblioitems.biblioitemnumber
+            LEFT JOIN itemtypes ON biblioitems.itemtype = itemtypes.itemtype
+            WHERE  itemnumber=$qitem
         ";
         $sth = $dbh->prepare($query);
     }
@@ -624,7 +622,9 @@ sub CheckReserves {
         # Look up the item by barcode
         my $query = "
             SELECT items.biblionumber, items.biblioitemnumber, itemtypes.notforloan
-            FROM   items, biblioitems, itemtypes
+            FROM   items
+            LEFT JOIN biblioitems ON items.biblioitemnumber = biblioitems.biblioitemnumber
+            LEFT JOIN itemtypes ON biblioitems.itemtype = itemtypes.itemtype
             WHERE  items.biblioitemnumber = biblioitems.biblioitemnumber
               AND biblioitems.itemtype = itemtypes.itemtype
               AND barcode=$qbc
@@ -704,7 +704,7 @@ priorities of the other people who are waiting on the book.
 sub CancelReserve {
     my ( $biblio, $item, $borr ) = @_;
     my $dbh = C4::Context->dbh;
-        if ( ( $item and $borr ) and ( not $biblio ) ) {
+        if ( $item and $borr ) {
         # removing a waiting reserve record....
         # update the database...
         my $query = "
@@ -719,7 +719,7 @@ sub CancelReserve {
         $sth->execute( $item, $borr );
         $sth->finish;
     }
-    if ( ( $biblio and $borr ) and ( not $item ) ) {
+    else {
         # removing a reserve record....
         # get the prioritiy on this record....
         my $priority;