Bugzilla – Attachment 76434 Details for
Bug 20946
Cannot pay fines for patrons with credits
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20946: Reduce number of db calls
Bug-20946-Reduce-number-of-db-calls.patch (text/plain), 1.61 KB, created by
Kyle M Hall (khall)
on 2018-06-26 13:09:35 UTC
(
hide
)
Description:
Bug 20946: Reduce number of db calls
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2018-06-26 13:09:35 UTC
Size:
1.61 KB
patch
obsolete
>From 854507a747ec642bf39d253c0b29448acf41a525 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 26 Jun 2018 13:08:36 +0000 >Subject: [PATCH] Bug 20946: Reduce number of db calls > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Account.pm | 19 ++++++------------- > 1 file changed, 6 insertions(+), 13 deletions(-) > >diff --git a/Koha/Account.pm b/Koha/Account.pm >index 02832d36c7..6a80d32bf1 100644 >--- a/Koha/Account.pm >+++ b/Koha/Account.pm >@@ -22,6 +22,7 @@ use Modern::Perl; > use Carp; > use Data::Dumper; > use List::MoreUtils qw( uniq ); >+use List::Util qw( sum ); > > use C4::Log qw( logaction ); > use C4::Stats qw( UpdateStats ); >@@ -297,19 +298,6 @@ my ( $total, $lines ) = Koha::Account->new({ patron_id => $patron_id })->outstan > sub outstanding_debits { > my ($self) = @_; > >- my $outstanding_debits = Koha::Account::Lines->search( >- { borrowernumber => $self->{patron_id}, >- amountoutstanding => { '>' => 0 } >- }, >- { select => [ { sum => 'amountoutstanding' } ], >- as => ['outstanding_debits_total'], >- } >- ); >- my $total >- = ( $outstanding_debits->count ) >- ? $outstanding_debits->next->get_column('outstanding_debits_total') + 0 >- : 0; >- > my $lines = Koha::Account::Lines->search( > { > borrowernumber => $self->{patron_id}, >@@ -317,6 +305,11 @@ sub outstanding_debits { > } > ); > >+ my $total = >+ ( $lines->count ) >+ ? sum( $lines->get_column('amountoutstanding') ) + 0 >+ : 0; >+ > return ( $total, $lines ); > } > >-- >2.15.2 (Apple Git-101.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 20946
:
76116
|
76317
|
76318
|
76394
|
76395
|
76432
|
76433
|
76434
|
76435
|
76437
|
76519
|
76521
|
76522
|
76632