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 <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2020-08-04 12:22:06 +02:00
parent c6f819840a
commit 53bd7b4075
1 changed files with 24 additions and 23 deletions

View File

@ -381,9 +381,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);
@ -415,7 +414,6 @@ sub TooMany {
}
);
my $maxonsiteissueqty_rule = Koha::CirculationRules->get_effective_rule(
{
categorycode => $cat_borrower,
@ -557,40 +555,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,
};
}