Bugzilla – Attachment 107734 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: TooMany refactoring
Bug-26132-TooMany-refactoring.patch (text/plain), 4.40 KB, created by
Jonathan Druart
on 2020-08-04 10:34:17 UTC
(
hide
)
Description:
Bug 26132: TooMany refactoring
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-08-04 10:34:17 UTC
Size:
4.40 KB
patch
obsolete
>From 5da8926b790be3141a192a31e9919c12ccd0b3d0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 3 Aug 2020 18:25:10 +0200 >Subject: [PATCH] Bug 26132: TooMany refactoring > >The different calls to _check_max_qty can be improved to highlight what >is really changing between each of them. >--- > C4/Circulation.pm | 56 +++++++++++++++-------------------------------- > 1 file changed, 18 insertions(+), 38 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index ee7f5a7ccd..7fc90e72b3 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -508,51 +508,31 @@ sub TooMany { > > my ( $checkout_count_type, $checkout_count, $onsite_checkout_count ) = $dbh->selectrow_array( $count_query, {}, @bind_params ); > >- my $max_onsite_checkouts_allowed = $maxonsiteissueqty_rule ? $maxonsiteissueqty_rule->rule_value : undef; >- >+ my $checkout_rules = { >+ checkout_count => $checkout_count, >+ onsite_checkout_count => $onsite_checkout_count, >+ onsite_checkout => $onsite_checkout, >+ max_checkouts_allowed => $maxissueqty_rule ? $maxissueqty_rule->rule_value : undef, >+ max_onsite_checkouts_allowed => $maxonsiteissueqty_rule ? $maxonsiteissueqty_rule->rule_value : undef, >+ switch_onsite_checkout => $switch_onsite_checkout, >+ }; > # If parent rules exists > if ( defined($parent_maxissueqty_rule) and defined($parent_maxissueqty_rule->rule_value) ){ >- my $max_checkouts_allowed = $parent_maxissueqty_rule->rule_value; >- >- my $qty_over = _check_max_qty({ >- checkout_count => $checkout_count, >- onsite_checkout_count => $onsite_checkout_count, >- onsite_checkout => $onsite_checkout, >- max_checkouts_allowed => $max_checkouts_allowed, >- max_onsite_checkouts_allowed => $max_onsite_checkouts_allowed, >- switch_onsite_checkout => $switch_onsite_checkout >- }); >+ $checkout_rules->{max_checkouts_allowed} = $parent_maxissueqty_rule ? $parent_maxissueqty_rule->rule_value : undef; >+ my $qty_over = _check_max_qty($checkout_rules); > return $qty_over if defined $qty_over; > >- >- # If the parent rule is less than or equal to the child, we only need check the parent >- if( $maxissueqty_rule->rule_value < $parent_maxissueqty_rule->rule_value && defined($maxissueqty_rule->itemtype) ) { >- my $max_checkouts_allowed = $maxissueqty_rule->rule_value; >- my $qty_over = _check_max_qty({ >- checkout_count => $checkout_count_type, >- onsite_checkout_count => $onsite_checkout_count, >- onsite_checkout => $onsite_checkout, >- max_checkouts_allowed => $max_checkouts_allowed, >- max_onsite_checkouts_allowed => $max_onsite_checkouts_allowed, >- switch_onsite_checkout => $switch_onsite_checkout >- }); >- return $qty_over if defined $qty_over; >- } >- >+ # If the parent rule is less than or equal to the child, we only need check the parent >+ if( $maxissueqty_rule->rule_value < $parent_maxissueqty_rule->rule_value && defined($maxissueqty_rule->itemtype) ) { >+ $checkout_rules->{checkout_count} = $checkout_count_type; >+ $checkout_rules->{max_checkouts_allowed} = $maxissueqty_rule ? $maxissueqty_rule->rule_value : undef; >+ my $qty_over = _check_max_qty($checkout_rules); >+ return $qty_over if defined $qty_over; >+ } > } else { >- my $max_checkouts_allowed = $maxissueqty_rule->rule_value; >- my $qty_over = _check_max_qty({ >- checkout_count => $checkout_count, >- onsite_checkout_count => $onsite_checkout_count, >- onsite_checkout => $onsite_checkout, >- max_checkouts_allowed => $max_checkouts_allowed, >- max_onsite_checkouts_allowed => $max_onsite_checkouts_allowed, >- switch_onsite_checkout => $switch_onsite_checkout >- }); >+ my $qty_over = _check_max_qty($checkout_rules); > return $qty_over if defined $qty_over; > } >- >- > } > > # Now count total loans against the limit for the branch >-- >2.20.1
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