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

(-)a/C4/Reserves.pm (-3 / +28 lines)
Lines 447-454 sub CanItemBeReserved{ Link Here
447
    # we retrieve borrowers and items informations #
447
    # we retrieve borrowers and items informations #
448
    my $item     = GetItem($itemnumber);
448
    my $item     = GetItem($itemnumber);
449
    my $borrower = C4::Members::GetMember('borrowernumber'=>$borrowernumber);     
449
    my $borrower = C4::Members::GetMember('borrowernumber'=>$borrowernumber);     
450
    
450
451
    # we retrieve user rights on this itemtype and branchcode
451
452
    # Before we check too see if the borrower has exceed the
453
    # maximum number of holds allowed for this itemtype,
454
    # we need to check to see if *any* holds are allowed
455
    # for this patron/itemtype as determined by the holds policy
456
    my $holds_policy = GetBranchItemRule(
457
          $controlbranch eq "ItemHomeLibrary"
458
        ? $item->{homebranch}
459
        : $borrower->{branchcode},
460
461
        $item->{itype}
462
    );
463
464
    if ( $holds_policy->{holdallowed} == 0 ) {
465
466
        # If holdallowed is 0, we can quit right here
467
        return 0;
468
    }
469
    elsif ( $holds_policy->{holdallowed} == 1 ) {
470
471
        # If it's 1, then only patrons from the item's home library may put this book on hold.
472
        return 0 unless ( $borrower->{'branchcode'} eq $item->{'homebranch'} );
473
    }
474
475
    # If we've gotten this far, the holds policy does not prevent the patron
476
    # from placing this hold. We now need to see if the patron has exceeded
477
    # the maximum number of holds allowed for this itemtype based on the patrons
452
    my $sth = $dbh->prepare("SELECT categorycode, itemtype, branchcode, reservesallowed 
478
    my $sth = $dbh->prepare("SELECT categorycode, itemtype, branchcode, reservesallowed 
453
                             FROM issuingrules 
479
                             FROM issuingrules 
454
                             WHERE (categorycode in (?,'*') ) 
480
                             WHERE (categorycode in (?,'*') ) 
455
- 

Return to bug 10314