View | Details | Raw Unified | Return to bug 29517
Collapse All | Expand All

(-)a/C4/Reserves.pm (-7 / +9 lines)
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 397-403 sub CanItemBeReserved { Link Here
397
398
398
    # we retrieve borrowers and items informations #
399
    # we retrieve borrowers and items informations #
399
    # item->{itype} will come for biblioitems if necessery
400
    # item->{itype} will come for biblioitems if necessery
400
    my $biblio   = $item->biblio;
401
    my $borrower = $patron->unblessed;
401
    my $borrower = $patron->unblessed;
402
402
403
    # If an item is damaged and we don't allow holds on damaged items, we can stop right here
403
    # If an item is damaged and we don't allow holds on damaged items, we can stop right here
Lines 405-414 sub CanItemBeReserved { Link Here
405
      if ( $item->damaged
405
      if ( $item->damaged
406
        && !C4::Context->preference('AllowHoldsOnDamagedItems') );
406
        && !C4::Context->preference('AllowHoldsOnDamagedItems') );
407
407
408
    # Check for the age restriction
408
    if( GetMarcFromKohaField('biblioitems.agerestriction') ){
409
    my ( $ageRestriction, $daysToAgeRestriction ) =
409
        my $biblio = $item->biblio;
410
      C4::Circulation::GetAgeRestriction( $biblio->biblioitem->agerestriction, $borrower );
410
        # Check for the age restriction
411
    return { status => 'ageRestricted' } if $daysToAgeRestriction && $daysToAgeRestriction > 0;
411
        my ( $ageRestriction, $daysToAgeRestriction ) =
412
          C4::Circulation::GetAgeRestriction( $biblio->biblioitem->agerestriction, $borrower );
413
        return { status => 'ageRestricted' } if $daysToAgeRestriction && $daysToAgeRestriction > 0;
414
    }
412
415
413
    # Check that the patron doesn't have an item level hold on this item already
416
    # Check that the patron doesn't have an item level hold on this item already
414
    return { status =>'itemAlreadyOnHold' }
417
    return { status =>'itemAlreadyOnHold' }
Lines 416-422 sub CanItemBeReserved { Link Here
416
419
417
    # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set)
420
    # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set)
418
    if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions')
421
    if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions')
419
        && C4::Circulation::CheckIfIssuedToPatron( $patron->borrowernumber, $biblio->biblionumber ) ) {
422
        && C4::Circulation::CheckIfIssuedToPatron( $patron->borrowernumber, $item->biblionumber ) ) {
420
        return { status =>'alreadypossession' };
423
        return { status =>'alreadypossession' };
421
    }
424
    }
422
425
423
- 

Return to bug 29517