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

(-)a/C4/Reserves.pm (-2 / +31 lines)
Lines 515-521 sub CanItemBeReserved{ Link Here
515
    my $controlbranch = C4::Context->preference('ReservesControlBranch');
515
    my $controlbranch = C4::Context->preference('ReservesControlBranch');
516
    my $itemtypefield = C4::Context->preference('item-level_itypes') ? "itype" : "itemtype";
516
    my $itemtypefield = C4::Context->preference('item-level_itypes') ? "itype" : "itemtype";
517
517
518
    # we retrieve user rights on this itemtype and branchcode
518
    # we retrieve borrowers and items informations #
519
    my $item     = GetItem($itemnumber);
520
    my $borrower = C4::Members::GetMember('borrowernumber'=>$borrowernumber);     
521
522
523
    # Before we check too see if the borrower has exceed the
524
    # maximum number of holds allowed for this itemtype,
525
    # we need to check to see if *any* holds are allowed
526
    # for this patron/itemtype as determined by the holds policy
527
    my $holds_policy = GetBranchItemRule(
528
          $controlbranch eq "ItemHomeLibrary"
529
        ? $item->{homebranch}
530
        : $borrower->{branchcode},
531
532
        $item->{itype}
533
    );
534
535
    if ( $holds_policy->{holdallowed} == 0 ) {
536
537
        # If holdallowed is 0, we can quit right here
538
        return 0;
539
    }
540
    elsif ( $holds_policy->{holdallowed} == 1 ) {
541
542
        # If it's 1, then only patrons from the item's home library may put this book on hold.
543
        return 0 unless ( $borrower->{'branchcode'} eq $item->{'homebranch'} );
544
    }
545
546
    # If we've gotten this far, the holds policy does not prevent the patron
547
    # from placing this hold. We now need to see if the patron has exceeded
548
    # the maximum number of holds allowed for this itemtype based on the patrons
519
    my $sth = $dbh->prepare("SELECT categorycode, itemtype, branchcode, reservesallowed
549
    my $sth = $dbh->prepare("SELECT categorycode, itemtype, branchcode, reservesallowed
520
                             FROM issuingrules
550
                             FROM issuingrules
521
                             WHERE (categorycode in (?,'*') )
551
                             WHERE (categorycode in (?,'*') )
522
- 

Return to bug 10314