From 7512ac00600531a0718e17fa862e973ece2ef2d6 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 1 Oct 2012 15:16:29 -0400 Subject: [PATCH] [SIGNED-OFF] Bug 5801 - C4::Circulation::_GetCircControlBranch wrongly used in opac-reserve.pl Signed-off-by: Chris Cormack Signed-off-by: Katrin Fischer All tests and perlcritic pass. Tests done: holds policy vs. circulation rules seemed to make the difference for me, I am not totally sure why that is, but see no reason to fail this patch as results are ok. System preferences - CircControlBranch = the library the item is from - ReservesControlBranch = patron's home library Circulation rules - Library A - Holds policy: Books can not be put on hold. - Library B - Holds policy: Books can be put on hold. (no special setting needed) Catalog data - A record with an item for library B, itemtype Books. Test without patch: 1) Patron A (home library A) places a hold in OPAC on an item from library B. Should be: hold is NOT allowed. Before patch: hold IS allowed. After patch: hold is NOT allowed. OK 2) ReserveControlbranch = item's home library Patron A (home library A) places a hold in OPAC on an item from library B. Should be: hold is allowed. Before patch: hold is allowed. After patch: hold is allowed. OK 3) ReservesControlBranch = patron's home library Circulation rules: Remove hold policy for library B. Library A: no holds allowed for books using 'Holds allowed (count)' = 0 Library B: 5 holds allowed for books using 'Holds allowed (count)' = 5 Patron A (home library A) places a hold in OPAC on an item from library B. Should be: hold is NOT allowed Before patch: hold is NOT allowed After patch: hold is NOT allowed OK 4) ReserveControlbranch = item's home library Should be: hold is allowed Before patch: hold is allowed After patch: hold is allowed OK --- opac/opac-reserve.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index bb23752..fbc9dd7 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -490,7 +490,7 @@ foreach my $biblioNum (@biblionumbers) { # If there is no loan, return and transfer, we show a checkbox. $itemLoopIter->{notforloan} = $itemLoopIter->{notforloan} || 0; - my $branch = C4::Circulation::_GetCircControlBranch($itemLoopIter, $borr); + my $branch = ( C4::Context->preference('ReservesControlBranch') eq 'ItemHomeLibrary' ) ? $itemInfo->{'homebranch'} : $borr->{'branchcode'}; my $branchitemrule = GetBranchItemRule( $branch, $itemInfo->{'itype'} ); my $policy_holdallowed = 1; -- 1.7.9.5