From 77aaf0dabfc19fcc6569f1b730154823ada94b5f 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=utf8 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 Signed-off-by: Nick Clemens Signed-off-by: Kyle M Hall (cherry picked from commit f04c5d5a2c549bed54036b726965ccda083def7b) Signed-off-by: Katrin Fischer --- C4/Circulation.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 2822ec9a68..13981c902c 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -829,11 +829,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.39.5