From 72b21ce42fb154fef51f6cfeb8685d5d9eafb008 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 4 Aug 2020 12:22:06 +0200 Subject: [PATCH] Bug 26132: Tidy _check_max_qty This is only a perltidy of _check_max_qty to remove some space inconsistencies, like: if( $max_checkouts_allowed eq '' ){ return;} if ( $checkout_count - $onsite_checkout_count >= $max_checkouts_allowed ) { Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi --- C4/Circulation.pm | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 3b46264c57..c7245b815f 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -382,9 +382,8 @@ sub TooMany { my $switch_onsite_checkout = $params->{switch_onsite_checkout} || 0; my $cat_borrower = $borrower->{'categorycode'}; my $dbh = C4::Context->dbh; - my $branch; - # Get which branchcode we need - $branch = _GetCircControlBranch($item_object->unblessed,$borrower); + # Get which branchcode we need + my $branch = _GetCircControlBranch($item_object->unblessed,$borrower); my $type = $item_object->effective_itemtype; my ($type_object, $parent_type, $parent_maxissueqty_rule); @@ -416,7 +415,6 @@ sub TooMany { } ); - my $maxonsiteissueqty_rule = Koha::CirculationRules->get_effective_rule( { categorycode => $cat_borrower, @@ -558,40 +556,43 @@ sub TooMany { } sub _check_max_qty { - my $params = shift; - my $checkout_count = $params->{checkout_count}; - my $onsite_checkout_count = $params->{onsite_checkout_count}; - my $onsite_checkout = $params->{onsite_checkout}; - my $max_checkouts_allowed = $params->{max_checkouts_allowed}; + my $params = shift; + my $checkout_count = $params->{checkout_count}; + my $onsite_checkout_count = $params->{onsite_checkout_count}; + my $onsite_checkout = $params->{onsite_checkout}; + my $max_checkouts_allowed = $params->{max_checkouts_allowed}; my $max_onsite_checkouts_allowed = $params->{max_onsite_checkouts_allowed}; - my $switch_onsite_checkout = $params->{switch_onsite_checkout}; + my $switch_onsite_checkout = $params->{switch_onsite_checkout}; if ( $onsite_checkout and defined $max_onsite_checkouts_allowed ) { - if( $max_onsite_checkouts_allowed eq '' ){ return;} - if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed ) { + if ( $max_onsite_checkouts_allowed eq '' ) { return; } + if ( $onsite_checkout_count >= $max_onsite_checkouts_allowed ) { return { - reason => 'TOO_MANY_ONSITE_CHECKOUTS', - count => $onsite_checkout_count, + reason => 'TOO_MANY_ONSITE_CHECKOUTS', + count => $onsite_checkout_count, max_allowed => $max_onsite_checkouts_allowed, - } + }; } } if ( C4::Context->preference('ConsiderOnSiteCheckoutsAsNormalCheckouts') ) { - if( $max_checkouts_allowed eq '' ){ return;} + if ( $max_checkouts_allowed eq '' ) { return; } my $delta = $switch_onsite_checkout ? 1 : 0; if ( $checkout_count >= $max_checkouts_allowed + $delta ) { return { - reason => 'TOO_MANY_CHECKOUTS', - count => $checkout_count, + reason => 'TOO_MANY_CHECKOUTS', + count => $checkout_count, max_allowed => $max_checkouts_allowed, }; } - } elsif ( not $onsite_checkout ) { - if( $max_checkouts_allowed eq '' ){ return;} - if ( $checkout_count - $onsite_checkout_count >= $max_checkouts_allowed ) { + } + elsif ( not $onsite_checkout ) { + if ( $max_checkouts_allowed eq '' ) { return; } + if ( + $checkout_count - $onsite_checkout_count >= $max_checkouts_allowed ) + { return { - reason => 'TOO_MANY_CHECKOUTS', - count => $checkout_count - $onsite_checkout_count, + reason => 'TOO_MANY_CHECKOUTS', + count => $checkout_count - $onsite_checkout_count, max_allowed => $max_checkouts_allowed, }; } -- 2.28.0