|
Lines 327-332
sub CanBookBeReserved{
Link Here
|
| 327 |
return { status =>'alreadypossession' }; |
327 |
return { status =>'alreadypossession' }; |
| 328 |
} |
328 |
} |
| 329 |
|
329 |
|
|
|
330 |
my $patron = Koha::Patrons->find($borrowernumber); |
| 331 |
my $holds = $patron->holds; |
| 332 |
|
| 333 |
# Check if borrower has reached the maximum number of holds allowed |
| 334 |
my $maxreserves = C4::Context->preference('maxreserves'); |
| 335 |
if ($maxreserves && $holds->count >= $maxreserves) { |
| 336 |
return { status => 'tooManyReserves', limit => $maxreserves }; |
| 337 |
} |
| 338 |
|
| 330 |
my @itemnumbers = Koha::Items->search({ biblionumber => $biblionumber})->get_column("itemnumber"); |
339 |
my @itemnumbers = Koha::Items->search({ biblionumber => $biblionumber})->get_column("itemnumber"); |
| 331 |
#get items linked via host records |
340 |
#get items linked via host records |
| 332 |
my @hostitems = get_hostitemnumbers_of($biblionumber); |
341 |
my @hostitems = get_hostitemnumbers_of($biblionumber); |
|
Lines 365-370
sub CanBookBeReserved{
Link Here
|
| 365 |
{ status => libraryNotPickupLocation }, if given branchcode is not configured to be a pickup location |
374 |
{ status => libraryNotPickupLocation }, if given branchcode is not configured to be a pickup location |
| 366 |
{ status => cannotBeTransferred }, if branch transfer limit applies on given item and branchcode |
375 |
{ status => cannotBeTransferred }, if branch transfer limit applies on given item and branchcode |
| 367 |
{ status => pickupNotInHoldGroup }, pickup location is not in hold group, and pickup locations are only allowed from hold groups. |
376 |
{ status => pickupNotInHoldGroup }, pickup location is not in hold group, and pickup locations are only allowed from hold groups. |
|
|
377 |
{ status => alreadyReserved }, if the borrower has already reserved this item. |
| 368 |
|
378 |
|
| 369 |
=cut |
379 |
=cut |
| 370 |
|
380 |
|
|
Lines 402-407
sub CanItemBeReserved {
Link Here
|
| 402 |
return { status =>'alreadypossession' }; |
412 |
return { status =>'alreadypossession' }; |
| 403 |
} |
413 |
} |
| 404 |
|
414 |
|
|
|
415 |
# Check if borrower has reached the maximum number of holds allowed |
| 416 |
my $maxreserves = C4::Context->preference('maxreserves'); |
| 417 |
my $holds = Koha::Holds->search( { borrowernumber => $borrowernumber } ); |
| 418 |
if ($maxreserves && $holds->count >= $maxreserves) { |
| 419 |
return { status => 'tooManyReserves', limit => $maxreserves }; |
| 420 |
} |
| 421 |
|
| 405 |
my $controlbranch = C4::Context->preference('ReservesControlBranch'); |
422 |
my $controlbranch = C4::Context->preference('ReservesControlBranch'); |
| 406 |
|
423 |
|
| 407 |
my $querycount = q{ |
424 |
my $querycount = q{ |
|
Lines 456-462
sub CanItemBeReserved {
Link Here
|
| 456 |
}; |
473 |
}; |
| 457 |
$search_params->{found} = undef if $params->{ignore_found_holds}; |
474 |
$search_params->{found} = undef if $params->{ignore_found_holds}; |
| 458 |
|
475 |
|
| 459 |
my $holds = Koha::Holds->search($search_params); |
476 |
$holds = Koha::Holds->search($search_params); |
| 460 |
if ( defined $holds_per_record && $holds_per_record ne '' ){ |
477 |
if ( defined $holds_per_record && $holds_per_record ne '' ){ |
| 461 |
if ( $holds_per_record == 0 ) { |
478 |
if ( $holds_per_record == 0 ) { |
| 462 |
return { status => "noReservesAllowed" }; |
479 |
return { status => "noReservesAllowed" }; |