@@ -, +, @@ translatability --- C4/Reserves.pm | 34 +++++++++++++++++--- .../prog/en/modules/reserve/request.tt | 24 +++++++------- reserve/request.pl | 10 +++++- 3 files changed, 51 insertions(+), 17 deletions(-) --- a/C4/Reserves.pm +++ a/C4/Reserves.pm @@ -107,6 +107,7 @@ BEGIN { &GetReserveCount &GetReserveInfo &GetReserveStatus + &GetAllowedReserves &GetOtherReserves @@ -458,7 +459,6 @@ sub CanItemBeReserved{ my $controlbranch = C4::Context->preference('ReservesControlBranch'); - # we retrieve user rights on this itemtype and branchcode my $sth = $dbh->prepare("SELECT categorycode, itemtype, branchcode, reservesallowed FROM issuingrules WHERE (categorycode in (?,'*') ) @@ -492,10 +492,11 @@ sub CanItemBeReserved{ } # we retrieve rights - $sth->execute($borrower->{'categorycode'}, $item->{'itype'}, $branchcode); - if(my $rights = $sth->fetchrow_hashref()){ + my $rights = GetAllowedReserves($borrower->{'categorycode'}, $item->{'itype'}, $branchcode); + + if( $rights ){ $ruleitemtype = $rights->{itemtype}; - $allowedreserves = $rights->{reservesallowed}; + $allowedreserves = $rights->{reservesallowed}; }else{ $ruleitemtype = '*'; } @@ -581,6 +582,31 @@ sub CanReserveBeCanceledFromOpac { } +=head2 GetAllowedReserves + + $number = &GetAllowedReserves($borrowernumber, $itemtype, $branchcode); + +this function returns the rights for a patron on itemtype and branchcode. +=cut + +sub GetAllowedReserves { + my ($categorycode, $itemtype, $branchcode) = @_; + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare("SELECT categorycode, itemtype, branchcode, reservesallowed + FROM issuingrules + WHERE (categorycode in (?,'*') ) + AND (itemtype IN (?,'*')) + AND (branchcode IN (?,'*')) + ORDER BY + categorycode DESC, + itemtype DESC, + branchcode DESC;" + ); + $sth->execute($categorycode, $itemtype, $branchcode); + return $sth->fetchrow_hashref(); +} + + =head2 GetReserveCount $number = &GetReserveCount($borrowernumber); --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt @@ -233,7 +233,7 @@ function checkMultiHold() { [% IF ( messagetransfert ) %]