Bugzilla – Attachment 108151 Details for
Bug 26132
Improve readability of TooMany
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26132: Tidy _check_max_qty
Bug-26132-Tidy-checkmaxqty.patch (text/plain), 4.40 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-08-12 18:16:37 UTC
(
hide
)
Description:
Bug 26132: Tidy _check_max_qty
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-08-12 18:16:37 UTC
Size:
4.40 KB
patch
obsolete
>From 72b21ce42fb154fef51f6cfeb8685d5d9eafb008 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >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 <nick@bywatersolutions.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > 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
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26132
:
107734
|
107735
|
107736
|
107737
|
107738
|
107796
|
107797
|
107798
|
107799
|
107800
|
107801
|
108147
|
108148
|
108149
|
108150
| 108151 |
108152
|
108153
|
113006
|
113007
|
113014
|
113034