Bugzilla – Attachment 81542 Details for
Bug 13098
Item lost multiple times by the same patron will create only be charged once
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13098: Sum at DBMS level
Bug-13098-Sum-at-DBMS-level.patch (text/plain), 1.18 KB, created by
Josef Moravec
on 2018-10-29 20:31:00 UTC
(
hide
)
Description:
Bug 13098: Sum at DBMS level
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2018-10-29 20:31:00 UTC
Size:
1.18 KB
patch
obsolete
>From 3ac4deec2923c6c1fc0f5c6a53adcf4d8ce53a0a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 25 Oct 2018 16:13:27 -0300 >Subject: [PATCH] Bug 13098: Sum at DBMS level > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > Koha/Account/Offsets.pm | 19 +++++++++++++------ > 1 file changed, 13 insertions(+), 6 deletions(-) > >diff --git a/Koha/Account/Offsets.pm b/Koha/Account/Offsets.pm >index d788058..bcc5a64 100644 >--- a/Koha/Account/Offsets.pm >+++ b/Koha/Account/Offsets.pm >@@ -18,7 +18,6 @@ package Koha::Account::Offsets; > use Modern::Perl; > > use Carp; >-use List::Util qw(sum0); > > use Koha::Database; > >@@ -41,11 +40,19 @@ Account offsets track the changes made to the balance of account lines > =cut > > sub total { >- my ( $self ) = @_; >- >- my $total = sum0( $self->get_column('amount') ); >- >- return $total; >+ my ($self) = @_; >+ >+ my $offsets = $self->search( >+ {}, >+ { >+ select => [ { sum => 'amount' } ], >+ as => ['total_amount'], >+ } >+ ); >+ >+ return $offsets->count >+ ? $offsets->next->get_column('total_amount') + 0 >+ : 0; > } > > =head2 Internal methods >-- >2.1.4
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 13098
:
80507
|
80678
|
80862
|
80863
|
80864
|
81105
|
81106
|
81107
|
81194
|
81195
|
81354
|
81538
|
81539
|
81540
|
81541
| 81542 |
81543