Lines 330-336
sub CanBookBeReserved{
Link Here
|
330 |
# Check if borrower has reached the maximum number of holds allowed |
330 |
# Check if borrower has reached the maximum number of holds allowed |
331 |
my $maxreserves = C4::Context->preference('maxreserves'); |
331 |
my $maxreserves = C4::Context->preference('maxreserves'); |
332 |
if ($maxreserves && $holds->count >= $maxreserves) { |
332 |
if ($maxreserves && $holds->count >= $maxreserves) { |
333 |
return { status => 'tooManyReserves' }; |
333 |
return { status => 'tooManyReserves', limit => $maxreserves }; |
334 |
} |
334 |
} |
335 |
|
335 |
|
336 |
my @itemnumbers = Koha::Items->search({ biblionumber => $biblionumber})->get_column("itemnumber"); |
336 |
my @itemnumbers = Koha::Items->search({ biblionumber => $biblionumber})->get_column("itemnumber"); |
Lines 403-420
sub CanItemBeReserved {
Link Here
|
403 |
return { status =>'itemAlreadyOnHold' } |
403 |
return { status =>'itemAlreadyOnHold' } |
404 |
if Koha::Holds->search( { borrowernumber => $borrowernumber, itemnumber => $itemnumber } )->count(); |
404 |
if Koha::Holds->search( { borrowernumber => $borrowernumber, itemnumber => $itemnumber } )->count(); |
405 |
|
405 |
|
406 |
<<<<<<< HEAD |
|
|
407 |
# Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set) |
406 |
# Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set) |
408 |
if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions') |
407 |
if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions') |
409 |
&& C4::Circulation::CheckIfIssuedToPatron( $patron->borrowernumber, $biblio->biblionumber ) ) { |
408 |
&& C4::Circulation::CheckIfIssuedToPatron( $patron->borrowernumber, $biblio->biblionumber ) ) { |
410 |
return { status =>'alreadypossession' }; |
409 |
return { status =>'alreadypossession' }; |
411 |
======= |
410 |
} |
|
|
411 |
|
412 |
# Check if borrower has reached the maximum number of holds allowed |
412 |
# Check if borrower has reached the maximum number of holds allowed |
413 |
my $maxreserves = C4::Context->preference('maxreserves'); |
413 |
my $maxreserves = C4::Context->preference('maxreserves'); |
414 |
my $holds = Koha::Holds->search( { borrowernumber => $borrowernumber } ); |
414 |
my $holds = Koha::Holds->search( { borrowernumber => $borrowernumber } ); |
415 |
if ($maxreserves && $holds->count >= $maxreserves) { |
415 |
if ($maxreserves && $holds->count >= $maxreserves) { |
416 |
return { status => 'tooManyReserves', limit => $maxreserves }; |
416 |
return { status => 'tooManyReserves', limit => $maxreserves }; |
417 |
>>>>>>> Bug 11999: Add maxreserves check in CanBookBeReserved and CanItemBeReserved |
|
|
418 |
} |
417 |
} |
419 |
|
418 |
|
420 |
my $controlbranch = C4::Context->preference('ReservesControlBranch'); |
419 |
my $controlbranch = C4::Context->preference('ReservesControlBranch'); |
Lines 451-475
sub CanItemBeReserved {
Link Here
|
451 |
$ruleitemtype = undef; |
450 |
$ruleitemtype = undef; |
452 |
} |
451 |
} |
453 |
|
452 |
|
454 |
<<<<<<< HEAD |
|
|
455 |
my $search_params = { |
453 |
my $search_params = { |
456 |
borrowernumber => $borrowernumber, |
454 |
borrowernumber => $borrowernumber, |
457 |
biblionumber => $item->biblionumber, |
455 |
biblionumber => $item->biblionumber, |
458 |
}; |
456 |
}; |
459 |
$search_params->{found} = undef if $params->{ignore_found_holds}; |
457 |
$search_params->{found} = undef if $params->{ignore_found_holds}; |
460 |
|
458 |
|
461 |
my $holds = Koha::Holds->search($search_params); |
459 |
$holds = Koha::Holds->search($search_params); |
462 |
if ( defined $holds_per_record && $holds_per_record ne '' |
460 |
if ( defined $holds_per_record && $holds_per_record ne '' |
463 |
&& $holds->count() >= $holds_per_record ) { |
461 |
&& $holds->count() >= $holds_per_record ) { |
464 |
======= |
|
|
465 |
$holds = Koha::Holds->search( |
466 |
{ |
467 |
borrowernumber => $borrowernumber, |
468 |
biblionumber => $item->biblionumber, |
469 |
} |
470 |
); |
471 |
if ( $holds->count() >= $holds_per_record ) { |
472 |
>>>>>>> Bug 11999: Add maxreserves check in CanBookBeReserved and CanItemBeReserved |
473 |
return { status => "tooManyHoldsForThisRecord", limit => $holds_per_record }; |
462 |
return { status => "tooManyHoldsForThisRecord", limit => $holds_per_record }; |
474 |
} |
463 |
} |
475 |
|
464 |
|