Lines 451-465
sub CanItemBeReserved {
Link Here
|
451 |
} |
451 |
} |
452 |
} |
452 |
} |
453 |
|
453 |
|
454 |
# we retrieve borrowers and items informations # |
|
|
455 |
# item->{itype} will come for biblioitems if necessery |
456 |
my $borrower = $patron->unblessed; |
457 |
|
454 |
|
|
|
455 |
# must check the notforloan setting of the itemtype |
456 |
# FIXME - a lot of places in the code do this |
457 |
# or something similar - need to be |
458 |
# consolidated |
459 |
my $itemtype = $item->effective_itemtype; |
460 |
return { status => 'missing_itemtype' } |
461 |
unless defined $itemtype; |
462 |
my $notforloan_per_itemtype = Koha::ItemTypes->find($itemtype)->notforloan; |
463 |
|
464 |
return { status => 'notforloan' } if ( $item->notforloan > 0 || $notforloan_per_itemtype ); |
465 |
return { status => 'itemlost' } if $item->itemlost; |
466 |
return { status => 'withdrawn' } if $item->withdrawn; |
458 |
# If an item is damaged and we don't allow holds on damaged items, we can stop right here |
467 |
# If an item is damaged and we don't allow holds on damaged items, we can stop right here |
459 |
return _cache { status =>'damaged' } |
468 |
return _cache { status =>'damaged' } |
460 |
if ( $item->damaged |
469 |
if ( $item->damaged |
461 |
&& !C4::Context->preference('AllowHoldsOnDamagedItems') ); |
470 |
&& !C4::Context->preference('AllowHoldsOnDamagedItems') ); |
462 |
|
471 |
|
|
|
472 |
# we retrieve borrowers information # |
473 |
my $borrower = $patron->unblessed; |
474 |
|
463 |
if( GetMarcFromKohaField('biblioitems.agerestriction') ){ |
475 |
if( GetMarcFromKohaField('biblioitems.agerestriction') ){ |
464 |
my $biblio = $item->biblio; |
476 |
my $biblio = $item->biblio; |
465 |
# Check for the age restriction |
477 |
# Check for the age restriction |
Lines 1336-1358
sub IsAvailableForItemLevelRequest {
Link Here
|
1336 |
my $patron = shift; |
1348 |
my $patron = shift; |
1337 |
my $pickup_branchcode = shift; |
1349 |
my $pickup_branchcode = shift; |
1338 |
|
1350 |
|
1339 |
my $dbh = C4::Context->dbh; |
|
|
1340 |
# must check the notforloan setting of the itemtype |
1341 |
# FIXME - a lot of places in the code do this |
1342 |
# or something similar - need to be |
1343 |
# consolidated |
1344 |
my $itemtype = $item->effective_itemtype; |
1345 |
return 0 |
1346 |
unless defined $itemtype; |
1347 |
my $notforloan_per_itemtype = Koha::ItemTypes->find($itemtype)->notforloan; |
1348 |
|
1349 |
return 0 if |
1350 |
$notforloan_per_itemtype || |
1351 |
$item->itemlost || |
1352 |
$item->notforloan > 0 || # item with negative or zero notforloan value is holdable |
1353 |
$item->withdrawn || |
1354 |
($item->damaged && !C4::Context->preference('AllowHoldsOnDamagedItems')); |
1355 |
|
1356 |
if ($pickup_branchcode) { |
1351 |
if ($pickup_branchcode) { |
1357 |
my $destination = Koha::Libraries->find($pickup_branchcode); |
1352 |
my $destination = Koha::Libraries->find($pickup_branchcode); |
1358 |
return 0 unless $destination; |
1353 |
return 0 unless $destination; |