Lines 421-433
sub CanItemBeReserved{
Link Here
|
421 |
my $dbh = C4::Context->dbh; |
421 |
my $dbh = C4::Context->dbh; |
422 |
my $allowedreserves = 0; |
422 |
my $allowedreserves = 0; |
423 |
|
423 |
|
424 |
my $controlbranch = C4::Context->preference('ReservesControlBranch'); |
|
|
425 |
my $itype = C4::Context->preference('item-level_itypes') ? "itype" : "itemtype"; |
426 |
|
427 |
# we retrieve borrowers and items informations # |
424 |
# we retrieve borrowers and items informations # |
428 |
my $item = GetItem($itemnumber); |
425 |
my $item = GetItem($itemnumber); |
|
|
426 |
|
427 |
# If an item is damaged and we don't allow holds on damaged items, we can stop right here |
428 |
return 0 if ( $item->{damaged} && !C4::Context->preference('AllowHoldsOnDamagedItems') ); |
429 |
|
429 |
my $borrower = C4::Members::GetMember('borrowernumber'=>$borrowernumber); |
430 |
my $borrower = C4::Members::GetMember('borrowernumber'=>$borrowernumber); |
430 |
|
431 |
|
|
|
432 |
my $controlbranch = C4::Context->preference('ReservesControlBranch'); |
433 |
my $itype = C4::Context->preference('item-level_itypes') ? "itype" : "itemtype"; |
434 |
|
431 |
# we retrieve user rights on this itemtype and branchcode |
435 |
# we retrieve user rights on this itemtype and branchcode |
432 |
my $sth = $dbh->prepare("SELECT categorycode, itemtype, branchcode, reservesallowed |
436 |
my $sth = $dbh->prepare("SELECT categorycode, itemtype, branchcode, reservesallowed |
433 |
FROM issuingrules |
437 |
FROM issuingrules |
Lines 809-815
sub CheckReserves {
Link Here
|
809 |
items.biblioitemnumber, |
813 |
items.biblioitemnumber, |
810 |
itemtypes.notforloan, |
814 |
itemtypes.notforloan, |
811 |
items.notforloan AS itemnotforloan, |
815 |
items.notforloan AS itemnotforloan, |
812 |
items.itemnumber |
816 |
items.itemnumber, |
|
|
817 |
items.damaged |
813 |
FROM items |
818 |
FROM items |
814 |
LEFT JOIN biblioitems ON items.biblioitemnumber = biblioitems.biblioitemnumber |
819 |
LEFT JOIN biblioitems ON items.biblioitemnumber = biblioitems.biblioitemnumber |
815 |
LEFT JOIN itemtypes ON items.itype = itemtypes.itemtype |
820 |
LEFT JOIN itemtypes ON items.itype = itemtypes.itemtype |
Lines 821-827
sub CheckReserves {
Link Here
|
821 |
items.biblioitemnumber, |
826 |
items.biblioitemnumber, |
822 |
itemtypes.notforloan, |
827 |
itemtypes.notforloan, |
823 |
items.notforloan AS itemnotforloan, |
828 |
items.notforloan AS itemnotforloan, |
824 |
items.itemnumber |
829 |
items.itemnumber, |
|
|
830 |
items.damaged |
825 |
FROM items |
831 |
FROM items |
826 |
LEFT JOIN biblioitems ON items.biblioitemnumber = biblioitems.biblioitemnumber |
832 |
LEFT JOIN biblioitems ON items.biblioitemnumber = biblioitems.biblioitemnumber |
827 |
LEFT JOIN itemtypes ON biblioitems.itemtype = itemtypes.itemtype |
833 |
LEFT JOIN itemtypes ON biblioitems.itemtype = itemtypes.itemtype |
Lines 837-849
sub CheckReserves {
Link Here
|
837 |
$sth->execute($barcode); |
843 |
$sth->execute($barcode); |
838 |
} |
844 |
} |
839 |
# note: we get the itemnumber because we might have started w/ just the barcode. Now we know for sure we have it. |
845 |
# note: we get the itemnumber because we might have started w/ just the barcode. Now we know for sure we have it. |
840 |
my ( $biblio, $bibitem, $notforloan_per_itemtype, $notforloan_per_item, $itemnumber ) = $sth->fetchrow_array; |
846 |
my ( $biblio, $bibitem, $notforloan_per_itemtype, $notforloan_per_item, $itemnumber, $damaged ) = $sth->fetchrow_array; |
|
|
847 |
|
848 |
return if ( $damaged && !C4::Context->preference('AllowHoldsOnDamagedItems') ); |
841 |
|
849 |
|
842 |
return ( '' ) unless $itemnumber; # bail if we got nothing. |
850 |
return unless $itemnumber; # bail if we got nothing. |
843 |
|
851 |
|
844 |
# if item is not for loan it cannot be reserved either..... |
852 |
# if item is not for loan it cannot be reserved either..... |
845 |
# execpt where items.notforloan < 0 : This indicates the item is holdable. |
853 |
# execpt where items.notforloan < 0 : This indicates the item is holdable. |
846 |
return ( '' ) if ( $notforloan_per_item > 0 ) or $notforloan_per_itemtype; |
854 |
return if ( $notforloan_per_item > 0 ) or $notforloan_per_itemtype; |
847 |
|
855 |
|
848 |
# Find this item in the reserves |
856 |
# Find this item in the reserves |
849 |
my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber ); |
857 |
my @reserves = _Findgroupreserve( $bibitem, $biblio, $itemnumber ); |