Lines 291-306
See CanItemBeReserved() for possible return values.
Link Here
|
291 |
sub CanBookBeReserved{ |
291 |
sub CanBookBeReserved{ |
292 |
my ($borrowernumber, $biblionumber) = @_; |
292 |
my ($borrowernumber, $biblionumber) = @_; |
293 |
|
293 |
|
294 |
# Check if borrower already has reserved the same biblio. |
294 |
# Check if borrower has reached the maximum number of holds allowed |
295 |
my $patron = Koha::Patrons->find($borrowernumber); |
295 |
my $patron = Koha::Patrons->find($borrowernumber); |
296 |
my $holds = $patron->holds; |
296 |
my $holds = $patron->holds; |
297 |
while (my $hold = $holds->next) { |
|
|
298 |
if ($hold->biblionumber == $biblionumber) { |
299 |
return 'alreadyReserved'; |
300 |
} |
301 |
} |
302 |
|
303 |
# Check if borrower has reached the maximum number of holds allowed |
304 |
my $maxreserves = C4::Context->preference('maxreserves'); |
297 |
my $maxreserves = C4::Context->preference('maxreserves'); |
305 |
if ($maxreserves && $holds->count >= $maxreserves) { |
298 |
if ($maxreserves && $holds->count >= $maxreserves) { |
306 |
return 'tooManyReserves'; |
299 |
return 'tooManyReserves'; |