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