Lines 289-294
sub CanBookBeReserved{
Link Here
|
289 |
return { status => 'tooManyReserves' }; |
289 |
return { status => 'tooManyReserves' }; |
290 |
} |
290 |
} |
291 |
|
291 |
|
|
|
292 |
# Check for the age restriction |
293 |
my $biblioData = C4::Biblio::GetBiblioData( $biblionumber ); |
294 |
my $borrower = $patron->unblessed; |
295 |
my ($ageRestriction, $daysToAgeRestriction) = C4::Circulation::GetAgeRestriction( $biblioData->{agerestriction}, $borrower ); |
296 |
return { status => 'ageRestricted' } if $daysToAgeRestriction && $daysToAgeRestriction > 0; |
297 |
|
292 |
my @itemnumbers = Koha::Items->search({ biblionumber => $biblionumber})->get_column("itemnumber"); |
298 |
my @itemnumbers = Koha::Items->search({ biblionumber => $biblionumber})->get_column("itemnumber"); |
293 |
|
299 |
|
294 |
#get items linked via host records |
300 |
#get items linked via host records |
Lines 311-317
sub CanBookBeReserved{
Link Here
|
311 |
$canReserve = &CanItemBeReserved($borrowernumber, $itemnumber, $branchcode) |
317 |
$canReserve = &CanItemBeReserved($borrowernumber, $itemnumber, $branchcode) |
312 |
if ($canReserve->{status} eq 'OK') { #We can reserve this Item! } |
318 |
if ($canReserve->{status} eq 'OK') { #We can reserve this Item! } |
313 |
|
319 |
|
314 |
<<<<<<< HEAD |
|
|
315 |
@RETURNS { status => OK }, if the Item can be reserved. |
320 |
@RETURNS { status => OK }, if the Item can be reserved. |
316 |
{ status => ageRestricted }, if the Item is age restricted for this borrower. |
321 |
{ status => ageRestricted }, if the Item is age restricted for this borrower. |
317 |
{ status => damaged }, if the Item is damaged. |
322 |
{ status => damaged }, if the Item is damaged. |
Lines 321-335
sub CanBookBeReserved{
Link Here
|
321 |
{ status => libraryNotFound }, if given branchcode is not an existing library |
326 |
{ status => libraryNotFound }, if given branchcode is not an existing library |
322 |
{ status => libraryNotPickupLocation }, if given branchcode is not configured to be a pickup location |
327 |
{ status => libraryNotPickupLocation }, if given branchcode is not configured to be a pickup location |
323 |
{ status => cannotBeTransferred }, if branch transfer limit applies on given item and branchcode |
328 |
{ status => cannotBeTransferred }, if branch transfer limit applies on given item and branchcode |
324 |
======= |
329 |
{ status => alreadyReserved }, if the borrower has already reserved this item. |
325 |
@RETURNS OK, if the Item can be reserved. |
|
|
326 |
ageRestricted, if the Item is age restricted for this borrower. |
327 |
damaged, if the Item is damaged. |
328 |
cannotReserveFromOtherBranches, if syspref 'canreservefromotherbranches' is OK. |
329 |
tooManyReserves, if the borrower has exceeded his maximum reserve amount. |
330 |
notReservable, if holds on this item are not allowed |
331 |
alreadyReserved, if the borrower has already reserved this item. |
332 |
>>>>>>> Bug 11999: Add two checks in CanBookBeReserved and CanItemBeReserved |
333 |
|
330 |
|
334 |
=cut |
331 |
=cut |
335 |
|
332 |
|
Lines 369-382
sub CanItemBeReserved {
Link Here
|
369 |
if ( $hold->itemnumber == $itemnumber |
366 |
if ( $hold->itemnumber == $itemnumber |
370 |
or $hold->biblionumber == $item->{biblionumber} ) |
367 |
or $hold->biblionumber == $item->{biblionumber} ) |
371 |
{ |
368 |
{ |
372 |
return 'alreadyReserved'; |
369 |
return { status => 'alreadyReserved' }; |
373 |
} |
370 |
} |
374 |
} |
371 |
} |
375 |
|
372 |
|
376 |
# Check if borrower has reached the maximum number of holds allowed |
373 |
# Check if borrower has reached the maximum number of holds allowed |
377 |
my $maxreserves = C4::Context->preference('maxreserves'); |
374 |
my $maxreserves = C4::Context->preference('maxreserves'); |
378 |
if ($maxreserves && $holds->count >= $maxreserves) { |
375 |
if ($maxreserves && $holds->count >= $maxreserves) { |
379 |
return 'tooManyReserves'; |
376 |
return { status => 'tooManyReserves' }; |
380 |
} |
377 |
} |
381 |
|
378 |
|
382 |
my $controlbranch = C4::Context->preference('ReservesControlBranch'); |
379 |
my $controlbranch = C4::Context->preference('ReservesControlBranch'); |