|
Lines 326-332
sub AddReserve {
Link Here
|
| 326 |
$canReserve = &CanBookBeReserved($borrowernumber, $biblionumber, $branchcode, $params) |
326 |
$canReserve = &CanBookBeReserved($borrowernumber, $biblionumber, $branchcode, $params) |
| 327 |
if ($canReserve eq 'OK') { #We can reserve this Item! } |
327 |
if ($canReserve eq 'OK') { #We can reserve this Item! } |
| 328 |
|
328 |
|
| 329 |
$params are passed directly through to CanItemBeReserved |
329 |
Accepts param 'return_all_items' which will process all items and return results of |
|
|
330 |
CanItemBeReserved |
| 331 |
All other $params are passed directly through to CanItemBeReserved |
| 330 |
|
332 |
|
| 331 |
See CanItemBeReserved() for possible return values. |
333 |
See CanItemBeReserved() for possible return values. |
| 332 |
|
334 |
|
|
Lines 334-339
See CanItemBeReserved() for possible return values.
Link Here
|
| 334 |
|
336 |
|
| 335 |
sub CanBookBeReserved{ |
337 |
sub CanBookBeReserved{ |
| 336 |
my ($borrowernumber, $biblionumber, $pickup_branchcode, $params) = @_; |
338 |
my ($borrowernumber, $biblionumber, $pickup_branchcode, $params) = @_; |
|
|
339 |
my $return_all_items = $params->{return_all_items} // 0; |
| 337 |
|
340 |
|
| 338 |
# Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set) |
341 |
# Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set) |
| 339 |
if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions') |
342 |
if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions') |
|
Lines 388-398
sub CanBookBeReserved{
Link Here
|
| 388 |
|
391 |
|
| 389 |
my $canReserve = { status => '' }; |
392 |
my $canReserve = { status => '' }; |
| 390 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
393 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
|
|
394 |
my %items; |
| 395 |
my $can_book_be_reserved = 0; |
| 391 |
while ( my $item = $items->next ) { |
396 |
while ( my $item = $items->next ) { |
| 392 |
$canReserve = CanItemBeReserved( $patron, $item, $pickup_branchcode, $params ); |
397 |
$canReserve = CanItemBeReserved( $patron, $item, $pickup_branchcode, $params ); |
| 393 |
return { status => 'OK' } if $canReserve->{status} eq 'OK'; |
398 |
$can_book_be_reserved = 1 if $canReserve->{status} eq 'OK'; |
|
|
399 |
return { status => 'OK' } if !$return_all_items && $can_book_be_reserved; |
| 400 |
$items{$item->itemnumber} = $canReserve; |
| 394 |
} |
401 |
} |
| 395 |
return $canReserve; |
402 |
return { |
|
|
403 |
status => $can_book_be_reserved ? 'OK' : $canReserve->{status}, |
| 404 |
%items |
| 405 |
}; |
| 396 |
} |
406 |
} |
| 397 |
|
407 |
|
| 398 |
=head2 CanItemBeReserved |
408 |
=head2 CanItemBeReserved |
| 399 |
- |
|
|