From 1a54fc3642ff885a852d197161974233a3fcf299 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Mon, 29 Aug 2011 11:21:24 +1200 Subject: [PATCH] Bug 5675 : CheckReserves not honouring item level itemtypes preferences Signed-off-by: Katrin Fischer 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 Signed-off-by: Chris Cormack --- C4/Reserves.pm | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 83738408af..f83f0ffd3a 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -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); -- 2.39.5