Lines 436-450
sub CanItemBeReserved {
Link Here
|
436 |
} |
436 |
} |
437 |
} |
437 |
} |
438 |
|
438 |
|
439 |
# we retrieve borrowers and items informations # |
|
|
440 |
# item->{itype} will come for biblioitems if necessery |
441 |
my $borrower = $patron->unblessed; |
442 |
|
439 |
|
|
|
440 |
# must check the notforloan setting of the itemtype |
441 |
# FIXME - a lot of places in the code do this |
442 |
# or something similar - need to be |
443 |
# consolidated |
444 |
my $itemtype = $item->effective_itemtype; |
445 |
return { status => 'missing_itemtype' } |
446 |
unless defined $itemtype; |
447 |
my $notforloan_per_itemtype = Koha::ItemTypes->find($itemtype)->notforloan; |
448 |
|
449 |
return { status => 'notforloan' } if ( $item->notforloan > 0 || $notforloan_per_itemtype ); |
450 |
return { status => 'itemlost' } if $item->itemlost; |
451 |
return { status => 'withdrawn' } if $item->withdrawn; |
443 |
# If an item is damaged and we don't allow holds on damaged items, we can stop right here |
452 |
# If an item is damaged and we don't allow holds on damaged items, we can stop right here |
444 |
return { status =>'damaged' } |
453 |
return { status =>'damaged' } |
445 |
if ( $item->damaged |
454 |
if ( $item->damaged |
446 |
&& !C4::Context->preference('AllowHoldsOnDamagedItems') ); |
455 |
&& !C4::Context->preference('AllowHoldsOnDamagedItems') ); |
447 |
|
456 |
|
|
|
457 |
# we retrieve borrowers information # |
458 |
my $borrower = $patron->unblessed; |
459 |
|
448 |
if( GetMarcFromKohaField('biblioitems.agerestriction') ){ |
460 |
if( GetMarcFromKohaField('biblioitems.agerestriction') ){ |
449 |
my $biblio = $item->biblio; |
461 |
my $biblio = $item->biblio; |
450 |
# Check for the age restriction |
462 |
# Check for the age restriction |
Lines 1360-1382
sub IsAvailableForItemLevelRequest {
Link Here
|
1360 |
# looped outside of IsAvailableForItemLevelRequest to avoid nested loops: |
1372 |
# looped outside of IsAvailableForItemLevelRequest to avoid nested loops: |
1361 |
my $items_any_available = shift; |
1373 |
my $items_any_available = shift; |
1362 |
|
1374 |
|
1363 |
my $dbh = C4::Context->dbh; |
|
|
1364 |
# must check the notforloan setting of the itemtype |
1365 |
# FIXME - a lot of places in the code do this |
1366 |
# or something similar - need to be |
1367 |
# consolidated |
1368 |
my $itemtype = $item->effective_itemtype; |
1369 |
return 0 |
1370 |
unless defined $itemtype; |
1371 |
my $notforloan_per_itemtype = Koha::ItemTypes->find($itemtype)->notforloan; |
1372 |
|
1373 |
return 0 if |
1374 |
$notforloan_per_itemtype || |
1375 |
$item->itemlost || |
1376 |
$item->notforloan > 0 || # item with negative or zero notforloan value is holdable |
1377 |
$item->withdrawn || |
1378 |
($item->damaged && !C4::Context->preference('AllowHoldsOnDamagedItems')); |
1379 |
|
1380 |
if ($pickup_branchcode) { |
1375 |
if ($pickup_branchcode) { |
1381 |
my $destination = Koha::Libraries->find($pickup_branchcode); |
1376 |
my $destination = Koha::Libraries->find($pickup_branchcode); |
1382 |
return 0 unless $destination; |
1377 |
return 0 unless $destination; |