From d8b2822b75c5251e1f8c90d548a86e0b31c3a9a6 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 31 Mar 2017 00:24:09 -0300 Subject: [PATCH] Bug 18321: Correctly calculate switch_onsite_checkout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Silly error here, the $switch_onsite_checkout is not correctly calculated, it should not only be set to the value of the syspref, but meet all the conditions. Test plan: Set a circ rule with number of on-site checkout = 2 and number of checkouts = 2. Switch on both ConsiderOnSiteCheckoutsAsNormalCheckouts and SwitchOnSiteCheckouts Do a regular checkout Do another regular checkout At this point you have reach the maximum number of checkouts allowed. Not try another one. => Without this patch you will not get the warning => With this patch you will see it Followed test plan, works as expected. Signed-off-by: Marc VĂ©ron --- C4/Circulation.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 13020ec..bff4049 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -830,11 +830,11 @@ sub CanBookBeIssued { # JB34 CHECKS IF BORROWERS DON'T HAVE ISSUE TOO MANY BOOKS # - my $switch_onsite_checkout = + my $switch_onsite_checkout = ( C4::Context->preference('SwitchOnSiteCheckouts') and $issue->{onsite_checkout} and $issue - and $issue->{borrowernumber} == $borrower->{'borrowernumber'} ? 1 : 0; + and $issue->{borrowernumber} == $borrower->{'borrowernumber'} ? 1 : 0 ); my $toomany = TooMany( $borrower, $item->{biblionumber}, $item, { onsite_checkout => $onsite_checkout, switch_onsite_checkout => $switch_onsite_checkout, } ); # if TooMany max_allowed returns 0 the user doesn't have permission to check out this book if ( $toomany ) { -- 2.1.4