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 382-388 sub CanItemBeReserved { Link Here
382
    # we retrieve borrowers and items informations #
383
    # we retrieve borrowers and items informations #
383
    # item->{itype} will come for biblioitems if necessery
384
    # item->{itype} will come for biblioitems if necessery
384
    my $item       = Koha::Items->find($itemnumber);
385
    my $item       = Koha::Items->find($itemnumber);
385
    my $biblio     = $item->biblio;
386
    my $patron = Koha::Patrons->find( $borrowernumber );
386
    my $patron = Koha::Patrons->find( $borrowernumber );
387
    my $borrower = $patron->unblessed;
387
    my $borrower = $patron->unblessed;
388
388
Lines 391-400 sub CanItemBeReserved { Link Here
391
      if ( $item->damaged
391
      if ( $item->damaged
392
        && !C4::Context->preference('AllowHoldsOnDamagedItems') );
392
        && !C4::Context->preference('AllowHoldsOnDamagedItems') );
393
393
394
    # Check for the age restriction
394
    if( GetMarcFromKohaField('biblioitems.agerestriction') ){
395
    my ( $ageRestriction, $daysToAgeRestriction ) =
395
        my $biblio     = $item->biblio;
396
      C4::Circulation::GetAgeRestriction( $biblio->biblioitem->agerestriction, $borrower );
396
        # Check for the age restriction
397
    return { status => 'ageRestricted' } if $daysToAgeRestriction && $daysToAgeRestriction > 0;
397
        my ( $ageRestriction, $daysToAgeRestriction ) =
398
          C4::Circulation::GetAgeRestriction( $biblio->biblioitem->agerestriction, $borrower );
399
        return { status => 'ageRestricted' } if $daysToAgeRestriction && $daysToAgeRestriction > 0;
400
    }
398
401
399
    # Check that the patron doesn't have an item level hold on this item already
402
    # Check that the patron doesn't have an item level hold on this item already
400
    return { status =>'itemAlreadyOnHold' }
403
    return { status =>'itemAlreadyOnHold' }
Lines 402-408 sub CanItemBeReserved { Link Here
402
405
403
    # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set)
406
    # Check that patron have not checked out this biblio (if AllowHoldsOnPatronsPossessions set)
404
    if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions')
407
    if ( !C4::Context->preference('AllowHoldsOnPatronsPossessions')
405
        && C4::Circulation::CheckIfIssuedToPatron( $patron->borrowernumber, $biblio->biblionumber ) ) {
408
        && C4::Circulation::CheckIfIssuedToPatron( $patron->borrowernumber, $item->biblionumber ) ) {
406
        return { status =>'alreadypossession' };
409
        return { status =>'alreadypossession' };
407
    }
410
    }
408
411
409
- 

Return to bug 29517