Bug 5675 : CheckReserves not honouring item level itemtypes preferences
authorChris Cormack <chrisc@catalyst.net.nz>
Sun, 28 Aug 2011 23:21:24 +0000 (11:21 +1200)
committerChris Cormack <chrisc@catalyst.net.nz>
Tue, 20 Sep 2011 21:16:53 +0000 (09:16 +1200)
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
With item level itypes activated only the item for which holds were
allowed in circulation rules triggered the hold notice on checkin.

Also checked that biblio level itype still trigered correctly.

Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
C4/Reserves.pm

index 8373840..f83f0ff 100644 (file)
@@ -760,17 +760,32 @@ sub CheckReserves {
     my ( $item, $barcode ) = @_;
     my $dbh = C4::Context->dbh;
     my $sth;
-    my $select = "
-    SELECT items.biblionumber,
+    my $select;
+    if (C4::Context->preference('item-level_itypes')){
+       $select = "
+           SELECT items.biblionumber,
            items.biblioitemnumber,
            itemtypes.notforloan,
            items.notforloan AS itemnotforloan,
            items.itemnumber
-    FROM   items
-    LEFT JOIN biblioitems ON items.biblioitemnumber = biblioitems.biblioitemnumber
-    LEFT JOIN itemtypes   ON biblioitems.itemtype   = itemtypes.itemtype
-    ";
-
+           FROM   items
+           LEFT JOIN biblioitems ON items.biblioitemnumber = biblioitems.biblioitemnumber
+           LEFT JOIN itemtypes   ON items.itype   = itemtypes.itemtype
+        ";
+    }
+    else {
+       $select = "
+           SELECT items.biblionumber,
+           items.biblioitemnumber,
+           itemtypes.notforloan,
+           items.notforloan AS itemnotforloan,
+           items.itemnumber
+           FROM   items
+           LEFT JOIN biblioitems ON items.biblioitemnumber = biblioitems.biblioitemnumber
+           LEFT JOIN itemtypes   ON biblioitems.itemtype   = itemtypes.itemtype
+        ";
+    }
+   
     if ($item) {
         $sth = $dbh->prepare("$select WHERE itemnumber = ?");
         $sth->execute($item);