|
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 320-325
sub CanBookBeReserved{
Link Here
|
| 320 |
{ status => libraryNotFound }, if given branchcode is not an existing library |
326 |
{ status => libraryNotFound }, if given branchcode is not an existing library |
| 321 |
{ 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 |
| 322 |
{ 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 |
|
|
329 |
{ status => alreadyReserved }, if the borrower has already reserved this item. |
| 323 |
|
330 |
|
| 324 |
=cut |
331 |
=cut |
| 325 |
|
332 |
|
|
Lines 359-372
sub CanItemBeReserved {
Link Here
|
| 359 |
if ( $hold->itemnumber == $itemnumber |
366 |
if ( $hold->itemnumber == $itemnumber |
| 360 |
or $hold->biblionumber == $item->{biblionumber} ) |
367 |
or $hold->biblionumber == $item->{biblionumber} ) |
| 361 |
{ |
368 |
{ |
| 362 |
return 'alreadyReserved'; |
369 |
return { status => 'alreadyReserved' }; |
| 363 |
} |
370 |
} |
| 364 |
} |
371 |
} |
| 365 |
|
372 |
|
| 366 |
# Check if borrower has reached the maximum number of holds allowed |
373 |
# Check if borrower has reached the maximum number of holds allowed |
| 367 |
my $maxreserves = C4::Context->preference('maxreserves'); |
374 |
my $maxreserves = C4::Context->preference('maxreserves'); |
| 368 |
if ($maxreserves && $holds->count >= $maxreserves) { |
375 |
if ($maxreserves && $holds->count >= $maxreserves) { |
| 369 |
return 'tooManyReserves'; |
376 |
return { status => 'tooManyReserves' }; |
| 370 |
} |
377 |
} |
| 371 |
|
378 |
|
| 372 |
my $controlbranch = C4::Context->preference('ReservesControlBranch'); |
379 |
my $controlbranch = C4::Context->preference('ReservesControlBranch'); |