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