Bugzilla – Attachment 107799 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: Don't prefetch if not needed
Bug-26132-Dont-prefetch-if-not-needed.patch (text/plain), 2.79 KB, created by
Nick Clemens (kidclamp)
on 2020-08-04 19:02:21 UTC
(
hide
)
Description:
Bug 26132: Don't prefetch if not needed
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-08-04 19:02:21 UTC
Size:
2.79 KB
patch
obsolete
>From 9f0b68f022ca1621edf68a0ed5fa3431f1b0ecf0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 4 Aug 2020 12:21:26 +0200 >Subject: [PATCH] Bug 26132: Don't prefetch if not needed > >We only need to prefetch items if CircControl is set to ItemHomeLibrary > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > C4/Circulation.pm | 17 +++++++++++------ > 1 file changed, 11 insertions(+), 6 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index c95be4bf89..3b46264c57 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -433,14 +433,17 @@ sub TooMany { > # rule > if (defined($maxissueqty_rule) and $maxissueqty_rule->rule_value ne "") { > >- my $checkouts = $patron->checkouts->search( {}, { prefetch => 'item' } ); >+ my $checkouts; > if ( $maxissueqty_rule->branchcode ) { > if ( C4::Context->preference('CircControl') eq 'PickupLibrary' ) { >- $checkouts = $checkouts->search({ 'me.branchcode' => $maxissueqty_rule->branchcode }); >+ $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 > } else { >- $checkouts = $checkouts->search({ 'item.homebranch' => $maxissueqty_rule->branchcode }); >+ $checkouts = $patron->checkouts->search( >+ { 'item.homebranch' => $maxissueqty_rule->branchcode }, >+ { prefetch => 'item' } ); > } > } > my $sum_checkouts; >@@ -517,13 +520,15 @@ sub TooMany { > # Now count total loans against the limit for the branch > my $branch_borrower_circ_rule = GetBranchBorrowerCircRule($branch, $cat_borrower); > if (defined($branch_borrower_circ_rule->{patron_maxissueqty}) and $branch_borrower_circ_rule->{patron_maxissueqty} ne '') { >- my $checkouts = $patron->checkouts->search({}, { prefetch => 'item' }); >+ my $checkouts; > if ( C4::Context->preference('CircControl') eq 'PickupLibrary' ) { >- $checkouts = $checkouts->search({ 'me.branchcode' => $branch }); >+ $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 > } else { >- $checkouts = $checkouts->search({ 'item.homebranch' => $branch }); >+ $checkouts = $patron->checkouts->search( >+ { 'item.homebranch' => $branch} ); > } > > my $checkout_count = $checkouts->count; >-- >2.11.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