|
Lines 486-500
sub CanItemBeReserved {
Link Here
|
| 486 |
} |
486 |
} |
| 487 |
} |
487 |
} |
| 488 |
|
488 |
|
| 489 |
# we retrieve borrowers and items informations # |
|
|
| 490 |
# item->{itype} will come for biblioitems if necessery |
| 491 |
my $borrower = $patron->unblessed; |
| 492 |
|
489 |
|
|
|
490 |
# must check the notforloan setting of the itemtype |
| 491 |
# FIXME - a lot of places in the code do this |
| 492 |
# or something similar - need to be |
| 493 |
# consolidated |
| 494 |
my $itemtype = $item->effective_itemtype; |
| 495 |
return { status => 'missing_itemtype' } |
| 496 |
unless defined $itemtype; |
| 497 |
my $notforloan_per_itemtype = Koha::ItemTypes->find($itemtype)->notforloan; |
| 498 |
|
| 499 |
return { status => 'notforloan' } if ( $item->notforloan > 0 || $notforloan_per_itemtype ); |
| 500 |
return { status => 'itemlost' } if $item->itemlost; |
| 501 |
return { status => 'withdrawn' } if $item->withdrawn; |
| 493 |
# If an item is damaged and we don't allow holds on damaged items, we can stop right here |
502 |
# If an item is damaged and we don't allow holds on damaged items, we can stop right here |
| 494 |
return _cache { status =>'damaged' } |
503 |
return _cache { status =>'damaged' } |
| 495 |
if ( $item->damaged |
504 |
if ( $item->damaged |
| 496 |
&& !C4::Context->preference('AllowHoldsOnDamagedItems') ); |
505 |
&& !C4::Context->preference('AllowHoldsOnDamagedItems') ); |
| 497 |
|
506 |
|
|
|
507 |
# we retrieve borrowers information # |
| 508 |
my $borrower = $patron->unblessed; |
| 509 |
|
| 498 |
if( GetMarcFromKohaField('biblioitems.agerestriction') ){ |
510 |
if( GetMarcFromKohaField('biblioitems.agerestriction') ){ |
| 499 |
my $biblio = $item->biblio; |
511 |
my $biblio = $item->biblio; |
| 500 |
# Check for the age restriction |
512 |
# Check for the age restriction |
|
Lines 1371-1393
sub IsAvailableForItemLevelRequest {
Link Here
|
| 1371 |
my $patron = shift; |
1383 |
my $patron = shift; |
| 1372 |
my $pickup_branchcode = shift; |
1384 |
my $pickup_branchcode = shift; |
| 1373 |
|
1385 |
|
| 1374 |
my $dbh = C4::Context->dbh; |
|
|
| 1375 |
# must check the notforloan setting of the itemtype |
| 1376 |
# FIXME - a lot of places in the code do this |
| 1377 |
# or something similar - need to be |
| 1378 |
# consolidated |
| 1379 |
my $itemtype = $item->effective_itemtype; |
| 1380 |
return 0 |
| 1381 |
unless defined $itemtype; |
| 1382 |
my $notforloan_per_itemtype = Koha::ItemTypes->find($itemtype)->notforloan; |
| 1383 |
|
| 1384 |
return 0 if |
| 1385 |
$notforloan_per_itemtype || |
| 1386 |
$item->itemlost || |
| 1387 |
$item->notforloan > 0 || # item with negative or zero notforloan value is holdable |
| 1388 |
$item->withdrawn || |
| 1389 |
($item->damaged && !C4::Context->preference('AllowHoldsOnDamagedItems')); |
| 1390 |
|
| 1391 |
if ($pickup_branchcode) { |
1386 |
if ($pickup_branchcode) { |
| 1392 |
my $destination = Koha::Libraries->find($pickup_branchcode); |
1387 |
my $destination = Koha::Libraries->find($pickup_branchcode); |
| 1393 |
return 0 unless $destination; |
1388 |
return 0 unless $destination; |