|
Lines 24-29
package C4::Reserves;
Link Here
|
| 24 |
use Modern::Perl; |
24 |
use Modern::Perl; |
| 25 |
|
25 |
|
| 26 |
use C4::Accounts; |
26 |
use C4::Accounts; |
|
|
27 |
use C4::Biblio qw( GetMarcFromKohaField ); |
| 27 |
use C4::Circulation qw( CheckIfIssuedToPatron GetAgeRestriction GetBranchItemRule ); |
28 |
use C4::Circulation qw( CheckIfIssuedToPatron GetAgeRestriction GetBranchItemRule ); |
| 28 |
use C4::Context; |
29 |
use C4::Context; |
| 29 |
use C4::Items qw( CartToShelf get_hostitemnumbers_of ); |
30 |
use C4::Items qw( CartToShelf get_hostitemnumbers_of ); |
|
Lines 398-404
sub CanItemBeReserved {
Link Here
|
| 398 |
|
399 |
|
| 399 |
# we retrieve borrowers and items informations # |
400 |
# we retrieve borrowers and items informations # |
| 400 |
# item->{itype} will come for biblioitems if necessery |
401 |
# item->{itype} will come for biblioitems if necessery |
| 401 |
my $biblio = $item->biblio; |
|
|
| 402 |
my $borrower = $patron->unblessed; |
402 |
my $borrower = $patron->unblessed; |
| 403 |
|
403 |
|
| 404 |
# If an item is damaged and we don't allow holds on damaged items, we can stop right here |
404 |
# If an item is damaged and we don't allow holds on damaged items, we can stop right here |
|
Lines 406-415
sub CanItemBeReserved {
Link Here
|
| 406 |
if ( $item->damaged |
406 |
if ( $item->damaged |
| 407 |
&& !C4::Context->preference('AllowHoldsOnDamagedItems') ); |
407 |
&& !C4::Context->preference('AllowHoldsOnDamagedItems') ); |
| 408 |
|
408 |
|
| 409 |
# Check for the age restriction |
409 |
if( GetMarcFromKohaField('biblioitems.agerestriction') ){ |
| 410 |
my ( $ageRestriction, $daysToAgeRestriction ) = |
410 |
my $biblio = $item->biblio; |
| 411 |
C4::Circulation::GetAgeRestriction( $biblio->biblioitem->agerestriction, $borrower ); |
411 |
# Check for the age restriction |
| 412 |
return { status => 'ageRestricted' } if $daysToAgeRestriction && $daysToAgeRestriction > 0; |
412 |
my ( $ageRestriction, $daysToAgeRestriction ) = |
|
|
413 |
C4::Circulation::GetAgeRestriction( $biblio->biblioitem->agerestriction, $borrower ); |
| 414 |
return { status => 'ageRestricted' } if $daysToAgeRestriction && $daysToAgeRestriction > 0; |
| 415 |
} |
| 413 |
|
416 |
|
| 414 |
# Check that the patron doesn't have an item level hold on this item already |
417 |
# Check that the patron doesn't have an item level hold on this item already |
| 415 |
return { status =>'itemAlreadyOnHold' } |
418 |
return { status =>'itemAlreadyOnHold' } |
|
Lines 417-423
sub CanItemBeReserved {
Link Here
|
| 417 |
|
420 |
|
| 418 |
# Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set) |
421 |
# Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set) |
| 419 |
if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions') |
422 |
if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions') |
| 420 |
&& C4::Circulation::CheckIfIssuedToPatron( $patron->borrowernumber, $biblio->biblionumber ) ) { |
423 |
&& C4::Circulation::CheckIfIssuedToPatron( $patron->borrowernumber, $item->biblionumber ) ) { |
| 421 |
return { status =>'alreadypossession' }; |
424 |
return { status =>'alreadypossession' }; |
| 422 |
} |
425 |
} |
| 423 |
|
426 |
|
| 424 |
- |
|
|