Browse Source

Bug 26132: (follow-up) Fix broken code in TooMany function

The $checkouts variable was not defined in the PatronLibrary case at
all and in the else case the SQL join was totally missing.

To test:
1) Without this patch notice prove
   t/db_dependent/Circulation/TooMany.t fails
2) With this patch notice prove
   t/db_dependent/Circulation/TooMany.t succeeds

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Joonas Kylmälä 4 years ago
committed by Jonathan Druart
parent
commit
31e9ac9a2c
  1. 5
      C4/Circulation.pm

5
C4/Circulation.pm

@ -543,10 +543,11 @@ sub TooMany {
$checkouts = $patron->checkouts->search(
{ 'me.branchcode' => $branch} );
} 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' => $branch} );
{ 'item.homebranch' => $branch},
{ prefetch => 'item' } );
}
my $checkout_count = $checkouts->count;

Loading…
Cancel
Save