From 4d9cb5162dce19228837d5a4b85ef281240f83be Mon Sep 17 00:00:00 2001 From: finlayt Date: Mon, 26 Aug 2002 22:34:29 +0000 Subject: [PATCH] rewrote CheckReserves so that it can be called with a barcode as well as on itemnumber. --- C4/Reserves2.pm | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/C4/Reserves2.pm b/C4/Reserves2.pm index 8d240d3a8e..35f04b3d02 100755 --- a/C4/Reserves2.pm +++ b/C4/Reserves2.pm @@ -97,16 +97,27 @@ sub FindReserves { } sub CheckReserves { - my ($item) = @_; - warn "In CheckReserves: itemnumber = $item"; + my ($item, $barcode) = @_; +# warn "In CheckReserves: itemnumber = $item"; my $dbh=C4Connect; - my $qitem=$dbh->quote($item); + my $sth; + if ($item) { + my $qitem=$dbh->quote($item); # get the biblionumber... - my $sth=$dbh->prepare("SELECT items.biblionumber, items.biblioitemnumber, itemtypes.notforloan + $sth=$dbh->prepare("SELECT items.biblionumber, items.biblioitemnumber, itemtypes.notforloan FROM items, biblioitems, itemtypes WHERE items.biblioitemnumber = biblioitems.biblioitemnumber AND biblioitems.itemtype = itemtypes.itemtype AND itemnumber=$qitem"); + } else { + my $qbc=$dbh->quote($barcode); +# get the biblionumber... + $sth=$dbh->prepare("SELECT items.biblionumber, items.biblioitemnumber, itemtypes.notforloan + FROM items, biblioitems, itemtypes + WHERE items.biblioitemnumber = biblioitems.biblioitemnumber + AND biblioitems.itemtype = itemtypes.itemtype + AND barcode=$qbc"); + } $sth->execute; my ($biblio, $bibitem, $notforloan) = $sth->fetchrow_array; $sth->finish; -- 2.39.5