Lines 352-357
sub CanBookBeReserved{
Link Here
|
352 |
current checkout against the high holds threshold |
352 |
current checkout against the high holds threshold |
353 |
|
353 |
|
354 |
@RETURNS { status => OK }, if the Item can be reserved. |
354 |
@RETURNS { status => OK }, if the Item can be reserved. |
|
|
355 |
{ status => onShelfHoldsNotAllowed }, if onShelfHoldsAllowed parameter and item availability combination doesn't allow holds. |
355 |
{ status => ageRestricted }, if the Item is age restricted for this borrower. |
356 |
{ status => ageRestricted }, if the Item is age restricted for this borrower. |
356 |
{ status => damaged }, if the Item is damaged. |
357 |
{ status => damaged }, if the Item is damaged. |
357 |
{ status => cannotReserveFromOtherBranches }, if syspref 'canreservefromotherbranches' is OK. |
358 |
{ status => cannotReserveFromOtherBranches }, if syspref 'canreservefromotherbranches' is OK. |
Lines 371-376
sub CanItemBeReserved {
Link Here
|
371 |
my $dbh = C4::Context->dbh; |
372 |
my $dbh = C4::Context->dbh; |
372 |
my $ruleitemtype; # itemtype of the matching issuing rule |
373 |
my $ruleitemtype; # itemtype of the matching issuing rule |
373 |
my $allowedreserves = 0; # Total number of holds allowed across all records, default to none |
374 |
my $allowedreserves = 0; # Total number of holds allowed across all records, default to none |
|
|
375 |
my $holds_per_record = 1; # Total number of holds allowed for this one given record |
376 |
my $holds_per_day; # Default to unlimited |
377 |
my $opacitemholds = 'Y'; # Itemlevel holds default to allowed |
378 |
my $on_shelf_holds = 0; # Default to "if any unavailable" |
379 |
my $context = $params->{context} // ''; |
374 |
|
380 |
|
375 |
# we retrieve borrowers and items informations # |
381 |
# we retrieve borrowers and items informations # |
376 |
# item->{itype} will come for biblioitems if necessery |
382 |
# item->{itype} will come for biblioitems if necessery |
Lines 442-451
sub CanItemBeReserved {
Link Here
|
442 |
categorycode => $borrower->{'categorycode'}, |
448 |
categorycode => $borrower->{'categorycode'}, |
443 |
itemtype => $item->effective_itemtype, |
449 |
itemtype => $item->effective_itemtype, |
444 |
branchcode => $branchcode, |
450 |
branchcode => $branchcode, |
445 |
rules => ['holds_per_record','holds_per_day'] |
451 |
rules => ['holds_per_record','holds_per_day','onshelfholds'] |
446 |
}); |
452 |
}); |
447 |
my $holds_per_record = $rights->{holds_per_record} // 1; |
453 |
$holds_per_record = $rights->{holds_per_record} // 1; |
448 |
my $holds_per_day = $rights->{holds_per_day}; |
454 |
$holds_per_day = $rights->{holds_per_day}; |
|
|
455 |
$on_shelf_holds = $rights->{onshelfholds}; |
449 |
|
456 |
|
450 |
my $search_params = { |
457 |
my $search_params = { |
451 |
borrowernumber => $borrowernumber, |
458 |
borrowernumber => $borrowernumber, |
Lines 453-458
sub CanItemBeReserved {
Link Here
|
453 |
}; |
460 |
}; |
454 |
$search_params->{found} = undef if $params->{ignore_found_holds}; |
461 |
$search_params->{found} = undef if $params->{ignore_found_holds}; |
455 |
|
462 |
|
|
|
463 |
# Check for item on shelves and OnShelfHoldsAllowed |
464 |
return { status => 'onShelfHoldsNotAllowed' } |
465 |
unless IsAvailableForItemLevelRequest($item, $patron, $pickup_branchcode,1); |
466 |
|
456 |
my $holds = Koha::Holds->search($search_params); |
467 |
my $holds = Koha::Holds->search($search_params); |
457 |
if ( defined $holds_per_record && $holds_per_record ne '' |
468 |
if ( defined $holds_per_record && $holds_per_record ne '' |
458 |
&& $holds->count() >= $holds_per_record ) { |
469 |
&& $holds->count() >= $holds_per_record ) { |