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

Followed test plan, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2017-03-31 00:24:09 -03:00 committed by Kyle M Hall
parent 1c7d283aae
commit f04c5d5a2c
1 changed files with 2 additions and 2 deletions

View File

@ -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 ) {