|
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 $opacitemholds = 'Y'; # Itemlevel holds default to allowed |
| 381 |
my $on_shelf_holds = 0; # Default to "if any unavailable" |
| 382 |
my $context = $params->{context} // ''; |
| 377 |
|
383 |
|
| 378 |
# we retrieve borrowers and items informations # |
384 |
# we retrieve borrowers and items informations # |
| 379 |
# item->{itype} will come for biblioitems if necessery |
385 |
# item->{itype} will come for biblioitems if necessery |
|
Lines 445-454
sub CanItemBeReserved {
Link Here
|
| 445 |
categorycode => $borrower->{'categorycode'}, |
451 |
categorycode => $borrower->{'categorycode'}, |
| 446 |
itemtype => $item->effective_itemtype, |
452 |
itemtype => $item->effective_itemtype, |
| 447 |
branchcode => $branchcode, |
453 |
branchcode => $branchcode, |
| 448 |
rules => ['holds_per_record','holds_per_day'] |
454 |
rules => ['holds_per_record','holds_per_day','onshelfholds'] |
| 449 |
}); |
455 |
}); |
| 450 |
my $holds_per_record = $rights->{holds_per_record} // 1; |
456 |
$holds_per_record = $rights->{holds_per_record} // 1; |
| 451 |
my $holds_per_day = $rights->{holds_per_day}; |
457 |
$holds_per_day = $rights->{holds_per_day}; |
|
|
458 |
$on_shelf_holds = $rights->{onshelfholds}; |
| 452 |
|
459 |
|
| 453 |
my $search_params = { |
460 |
my $search_params = { |
| 454 |
borrowernumber => $borrowernumber, |
461 |
borrowernumber => $borrowernumber, |
|
Lines 456-461
sub CanItemBeReserved {
Link Here
|
| 456 |
}; |
463 |
}; |
| 457 |
$search_params->{found} = undef if $params->{ignore_found_holds}; |
464 |
$search_params->{found} = undef if $params->{ignore_found_holds}; |
| 458 |
|
465 |
|
|
|
466 |
# Check for item on shelves and OnShelfHoldsAllowed |
| 467 |
return { status => 'onShelfHoldsNotAllowed' } |
| 468 |
unless IsAvailableForItemLevelRequest($item, $patron, $pickup_branchcode,1); |
| 469 |
|
| 459 |
my $holds = Koha::Holds->search($search_params); |
470 |
my $holds = Koha::Holds->search($search_params); |
| 460 |
if ( defined $holds_per_record && $holds_per_record ne '' ){ |
471 |
if ( defined $holds_per_record && $holds_per_record ne '' ){ |
| 461 |
if ( $holds_per_record == 0 ) { |
472 |
if ( $holds_per_record == 0 ) { |