Bug 26132: (follow-up) Count all checkouts if no limits needed
authorNick Clemens <nick@bywatersolutions.com>
Tue, 4 Aug 2020 19:01:30 +0000 (19:01 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 13 Aug 2020 08:15:33 +0000 (10:15 +0200)
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>

C4/Circulation.pm

index a379742..6297286 100644 (file)
@@ -436,12 +436,14 @@ sub TooMany {
                 $checkouts = $patron->checkouts->search(
                     { '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
+                $checkouts = $patron->checkouts; # if branch is the patron's home branch, then count all loans by patron
             } else {
                 $checkouts = $patron->checkouts->search(
                     { 'item.homebranch' => $maxissueqty_rule->branchcode },
                     { prefetch          => 'item' } );
             }
+        } else {
+            $checkouts = $patron->checkouts; # if rule is not branch specific then count all loans by patron
         }
         my $sum_checkouts;
         my $rule_itemtype = $maxissueqty_rule->itemtype;