Lines 824-838
sub CheckReserves {
Link Here
|
824 |
my ( $item, $barcode ) = @_; |
824 |
my ( $item, $barcode ) = @_; |
825 |
my $dbh = C4::Context->dbh; |
825 |
my $dbh = C4::Context->dbh; |
826 |
my $sth; |
826 |
my $sth; |
|
|
827 |
my $item_type_control = (C4::Context->preference('item-level_itypes')) ? "items.itype" : "biblioitems.itemtype"; |
827 |
my $select = " |
828 |
my $select = " |
828 |
SELECT items.biblionumber, |
829 |
SELECT items.biblionumber, |
829 |
items.biblioitemnumber, |
830 |
items.biblioitemnumber, |
830 |
itemtypes.notforloan, |
831 |
itemtypes.notforloan, |
831 |
items.notforloan AS itemnotforloan, |
832 |
items.notforloan AS itemnotforloan, |
832 |
items.itemnumber |
833 |
items.itemnumber, |
|
|
834 |
items.homebranch, |
835 |
$item_type_control |
833 |
FROM items |
836 |
FROM items |
834 |
LEFT JOIN biblioitems ON items.biblioitemnumber = biblioitems.biblioitemnumber |
837 |
LEFT JOIN biblioitems ON items.biblioitemnumber = biblioitems.biblioitemnumber |
835 |
LEFT JOIN itemtypes ON biblioitems.itemtype = itemtypes.itemtype |
838 |
LEFT JOIN itemtypes ON $item_type_control = itemtypes.itemtype |
836 |
"; |
839 |
"; |
837 |
|
840 |
|
838 |
if ($item) { |
841 |
if ($item) { |
Lines 844-850
sub CheckReserves {
Link Here
|
844 |
$sth->execute($barcode); |
847 |
$sth->execute($barcode); |
845 |
} |
848 |
} |
846 |
# note: we get the itemnumber because we might have started w/ just the barcode. Now we know for sure we have it. |
849 |
# note: we get the itemnumber because we might have started w/ just the barcode. Now we know for sure we have it. |
847 |
my ( $biblio, $bibitem, $notforloan_per_itemtype, $notforloan_per_item, $itemnumber ) = $sth->fetchrow_array; |
850 |
my ( $biblio, $bibitem, $notforloan_per_itemtype, $notforloan_per_item, $itemnumber, $homebranch, $itemtype ) = $sth->fetchrow_array; |
848 |
|
851 |
|
849 |
return ( 0, 0 ) unless $itemnumber; # bail if we got nothing. |
852 |
return ( 0, 0 ) unless $itemnumber; # bail if we got nothing. |
850 |
|
853 |
|
Lines 852-857
sub CheckReserves {
Link Here
|
852 |
# execpt where items.notforloan < 0 : This indicates the item is holdable. |
855 |
# execpt where items.notforloan < 0 : This indicates the item is holdable. |
853 |
return ( 0, 0 ) if ( $notforloan_per_item > 0 ) or $notforloan_per_itemtype; |
856 |
return ( 0, 0 ) if ( $notforloan_per_item > 0 ) or $notforloan_per_itemtype; |
854 |
|
857 |
|
|
|
858 |
# if circulation policies say "No Holds Allowed" on this item, it cannot be reserved |
859 |
my $branchitemrule = C4::Circulation::GetBranchItemRule($homebranch, $itemtype); |
860 |
return ( 0, 0 ) unless ($branchitemrule->{'holdallowed'}); |
861 |
|
855 |
# Find this item in the reserves |
862 |
# Find this item in the reserves |
856 |
my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber ); |
863 |
my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber ); |
857 |
|
864 |
|
858 |
- |
|
|