|
Lines 343-348
sub CanBookBeReserved{
Link Here
|
| 343 |
current checkout against the high holds threshold |
343 |
current checkout against the high holds threshold |
| 344 |
|
344 |
|
| 345 |
@RETURNS { status => OK }, if the Item can be reserved. |
345 |
@RETURNS { status => OK }, if the Item can be reserved. |
|
|
346 |
{ status => onShelfHoldsNotAllowed }, if onShelfHoldsAllowed parameter and item availability combination doesn't allow holds. |
| 346 |
{ status => ageRestricted }, if the Item is age restricted for this borrower. |
347 |
{ status => ageRestricted }, if the Item is age restricted for this borrower. |
| 347 |
{ status => damaged }, if the Item is damaged. |
348 |
{ status => damaged }, if the Item is damaged. |
| 348 |
{ status => cannotReserveFromOtherBranches }, if syspref 'canreservefromotherbranches' is OK. |
349 |
{ status => cannotReserveFromOtherBranches }, if syspref 'canreservefromotherbranches' is OK. |
|
Lines 365-372
sub CanItemBeReserved {
Link Here
|
| 365 |
my $holds_per_record = 1; # Total number of holds allowed for this one given record |
366 |
my $holds_per_record = 1; # Total number of holds allowed for this one given record |
| 366 |
my $holds_per_day; # Default to unlimited |
367 |
my $holds_per_day; # Default to unlimited |
| 367 |
|
368 |
|
|
|
369 |
my $opacitemholds = 'Y'; # Itemlevel holds default to allowed |
| 370 |
my $on_shelf_holds = 0; # Default to "if any unavailable" |
| 371 |
|
| 372 |
# Get calling context |
| 373 |
my $caller = (caller(1))[3]; |
| 374 |
|
| 368 |
# we retrieve borrowers and items informations # |
375 |
# we retrieve borrowers and items informations # |
| 369 |
# item->{itype} will come for biblioitems if necessery |
376 |
# item->{itype} will come for biblioitems if necessery |
|
|
377 |
|
| 370 |
my $item = Koha::Items->find($itemnumber); |
378 |
my $item = Koha::Items->find($itemnumber); |
| 371 |
my $biblio = $item->biblio; |
379 |
my $biblio = $item->biblio; |
| 372 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
380 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
|
Lines 415-420
sub CanItemBeReserved {
Link Here
|
| 415 |
$allowedreserves = $rights->{reservesallowed} // $allowedreserves; |
423 |
$allowedreserves = $rights->{reservesallowed} // $allowedreserves; |
| 416 |
$holds_per_record = $rights->{holds_per_record} // $holds_per_record; |
424 |
$holds_per_record = $rights->{holds_per_record} // $holds_per_record; |
| 417 |
$holds_per_day = $rights->{holds_per_day}; |
425 |
$holds_per_day = $rights->{holds_per_day}; |
|
|
426 |
$opacitemholds = $rights->{opacitemholds}; |
| 427 |
$on_shelf_holds = $rights->{onshelfholds}; |
| 418 |
} |
428 |
} |
| 419 |
else { |
429 |
else { |
| 420 |
$ruleitemtype = undef; |
430 |
$ruleitemtype = undef; |
|
Lines 424-431
sub CanItemBeReserved {
Link Here
|
| 424 |
borrowernumber => $borrowernumber, |
434 |
borrowernumber => $borrowernumber, |
| 425 |
biblionumber => $item->biblionumber, |
435 |
biblionumber => $item->biblionumber, |
| 426 |
}; |
436 |
}; |
|
|
437 |
|
| 427 |
$search_params->{found} = undef if $params->{ignore_found_holds}; |
438 |
$search_params->{found} = undef if $params->{ignore_found_holds}; |
| 428 |
|
439 |
|
|
|
440 |
if ( $opacitemholds eq "N" and index($caller,"CanBookBeReserved") eq -1 ) { |
| 441 |
return { status => "notReservable" }; |
| 442 |
} |
| 443 |
|
| 444 |
# Check for item on shelves and OnShelfHoldsAllowed |
| 445 |
return { status => 'onShelfHoldsNotAllowed' } |
| 446 |
if ( 0 == ( |
| 447 |
$item->{'notforloan'} or |
| 448 |
$item->{'onloan'} or |
| 449 |
$item->{'itemlost'} or |
| 450 |
$item->{'withdrawn'} or |
| 451 |
$item->{'damaged'} ) |
| 452 |
&& ($on_shelf_holds != "1")); |
| 453 |
|
| 454 |
$item = Koha::Items->find( $itemnumber ); |
| 455 |
|
| 429 |
my $holds = Koha::Holds->search($search_params); |
456 |
my $holds = Koha::Holds->search($search_params); |
| 430 |
if ( defined $holds_per_record && $holds_per_record ne '' |
457 |
if ( defined $holds_per_record && $holds_per_record ne '' |
| 431 |
&& $holds->count() >= $holds_per_record ) { |
458 |
&& $holds->count() >= $holds_per_record ) { |
|
Lines 2264-2270
sub GetHoldRule {
Link Here
|
| 2264 |
itemtype => $itemtype, |
2291 |
itemtype => $itemtype, |
| 2265 |
categorycode => $categorycode, |
2292 |
categorycode => $categorycode, |
| 2266 |
branchcode => $branchcode, |
2293 |
branchcode => $branchcode, |
| 2267 |
rules => ['holds_per_record', 'holds_per_day'], |
2294 |
rules => ['holds_per_record', 'holds_per_day', 'opacitemholds', 'onshelfholds'], |
| 2268 |
order_by => { |
2295 |
order_by => { |
| 2269 |
-desc => [ 'categorycode', 'itemtype', 'branchcode' ] |
2296 |
-desc => [ 'categorycode', 'itemtype', 'branchcode' ] |
| 2270 |
} |
2297 |
} |
|
Lines 2272-2277
sub GetHoldRule {
Link Here
|
| 2272 |
); |
2299 |
); |
| 2273 |
$rules->{holds_per_record} = $holds_per_x_rules->{holds_per_record}; |
2300 |
$rules->{holds_per_record} = $holds_per_x_rules->{holds_per_record}; |
| 2274 |
$rules->{holds_per_day} = $holds_per_x_rules->{holds_per_day}; |
2301 |
$rules->{holds_per_day} = $holds_per_x_rules->{holds_per_day}; |
|
|
2302 |
$rules->{opacitemholds} = $holds_per_x_rules->{opacitemholds}; |
| 2303 |
$rules->{onshelfholds} = $holds_per_x_rules->{onshelfholds}; |
| 2275 |
|
2304 |
|
| 2276 |
return $rules; |
2305 |
return $rules; |
| 2277 |
} |
2306 |
} |