@@ -, +, @@ policies a hold on this item fail, but instead it will succeed hold on this item --- C4/Reserves.pm | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) --- a/C4/Reserves.pm +++ a/C4/Reserves.pm @@ -427,8 +427,34 @@ sub CanItemBeReserved{ # we retrieve borrowers and items informations # my $item = GetItem($itemnumber); my $borrower = C4::Members::GetMember('borrowernumber'=>$borrowernumber); - - # we retrieve user rights on this itemtype and branchcode + + + # Before we check too see if the borrower has exceed the + # maximum number of holds allowed for this itemtype, + # we need to check to see if *any* holds are allowed + # for this patron/itemtype as determined by the holds policy + my $holds_policy = GetBranchItemRule( + $controlbranch eq "ItemHomeLibrary" + ? $item->{homebranch} + : $borrower->{branchcode}, + + $item->{itype} + ); + + if ( $holds_policy->{holdallowed} == 0 ) { + + # If holdallowed is 0, we can quit right here + return 0; + } + elsif ( $holds_policy->{holdallowed} == 1 ) { + + # If it's 1, then only patrons from the item's home library may put this book on hold. + return 0 unless ( $borrower->{'branchcode'} eq $item->{'homebranch'} ); + } + + # If we've gotten this far, the holds policy does not prevent the patron + # from placing this hold. We now need to see if the patron has exceeded + # the maximum number of holds allowed for this itemtype based on the patrons my $sth = $dbh->prepare("SELECT categorycode, itemtype, branchcode, reservesallowed FROM issuingrules WHERE (categorycode in (?,'*') ) --