From 19e848ba0efeb44a10786d13b4e6e945188b674c Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 5 Nov 2020 09:21:01 +0100 Subject: [PATCH] Bug 26132: continuing code golf --- C4/Circulation.pm | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index bc77eba6cd..8e35de271e 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -451,18 +451,16 @@ sub TooMany { my $checkouts; my $where = {}; - my $attr = { prefetch => 'item' }; + my $attr = { join => 'item' }; if ( $maxissueqty_rule->branchcode ) { if ( C4::Context->preference('CircControl') eq 'PickupLibrary' ) { $where = { 'me.branchcode' => $maxissueqty_rule->branchcode }; - } elsif (C4::Context->preference('CircControl') eq 'PatronLibrary') { - # if branch is the patron's home branch, then count all loans by patron - } else { + } elsif (C4::Context->preference('CircControl') ne 'PatronLibrary') { $where = { 'item.homebranch' => $maxissueqty_rule->branchcode }; } - } else { - # if rule is not branch specific then count all loans by patron - } + # elsif branch is the patron's home branch, then count all loans by patron + } # elsif rule is not branch specific then count all loans by patron + $checkouts = $patron->checkouts->search( $where, $attr ); my $sum_checkouts; my $rule_itemtype = $maxissueqty_rule->itemtype; -- 2.20.1