From 33acacb18760968896f24e341e6009eb2a1c452f 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 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 --- 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