rewrote CheckReserves so that it can be called with a barcode as well as on itemnumber.

This commit is contained in:
finlayt 2002-08-26 22:34:29 +00:00
parent d96ae9ae65
commit 4d9cb5162d

View file

@ -97,16 +97,27 @@ sub FindReserves {
} }
sub CheckReserves { sub CheckReserves {
my ($item) = @_; my ($item, $barcode) = @_;
warn "In CheckReserves: itemnumber = $item"; # warn "In CheckReserves: itemnumber = $item";
my $dbh=C4Connect; my $dbh=C4Connect;
my $qitem=$dbh->quote($item); my $sth;
if ($item) {
my $qitem=$dbh->quote($item);
# get the biblionumber... # 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 FROM items, biblioitems, itemtypes
WHERE items.biblioitemnumber = biblioitems.biblioitemnumber WHERE items.biblioitemnumber = biblioitems.biblioitemnumber
AND biblioitems.itemtype = itemtypes.itemtype AND biblioitems.itemtype = itemtypes.itemtype
AND itemnumber=$qitem"); 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; $sth->execute;
my ($biblio, $bibitem, $notforloan) = $sth->fetchrow_array; my ($biblio, $bibitem, $notforloan) = $sth->fetchrow_array;
$sth->finish; $sth->finish;