Bugzilla – Attachment 76449 Details for
Bug 20990
Add Koha::Account::outstanding_credits
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20990: Make same changes that were made to outstanding_debits
Bug-20990-Make-same-changes-that-were-made-to-outs.patch (text/plain), 2.53 KB, created by
Kyle M Hall (khall)
on 2018-06-26 14:32:28 UTC
(
hide
)
Description:
Bug 20990: Make same changes that were made to outstanding_debits
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2018-06-26 14:32:28 UTC
Size:
2.53 KB
patch
obsolete
>From 5090eadb5d5fbf6cd8b4d358f01331e374c4e41d Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 26 Jun 2018 14:31:40 +0000 >Subject: [PATCH] Bug 20990: Make same changes that were made to > outstanding_debits > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Account.pm | 18 ++++-------------- > t/db_dependent/Koha/Account.t | 6 +++++- > 2 files changed, 9 insertions(+), 15 deletions(-) > >diff --git a/Koha/Account.pm b/Koha/Account.pm >index 57d5193400..d7555321c7 100644 >--- a/Koha/Account.pm >+++ b/Koha/Account.pm >@@ -415,7 +415,7 @@ sub outstanding_debits { > } > ); > >- # sum returns undef it list is empty >+ # sum returns undef if list is empty > my $total = sum( $lines->get_column('amountoutstanding') ) + 0; > > return ( $total, $lines ); >@@ -430,19 +430,6 @@ my ( $total, $lines ) = Koha::Account->new({ patron_id => $patron_id })->outstan > sub outstanding_credits { > my ($self) = @_; > >- my $outstanding_credits = Koha::Account::Lines->search( >- { borrowernumber => $self->{patron_id}, >- amountoutstanding => { '<' => 0 } >- }, >- { select => [ { sum => 'amountoutstanding' } ], >- as => ['outstanding_credits_total'], >- } >- ); >- my $total >- = ( $outstanding_credits->count ) >- ? $outstanding_credits->next->get_column('outstanding_credits_total') + 0 >- : 0; >- > my $lines = Koha::Account::Lines->search( > { > borrowernumber => $self->{patron_id}, >@@ -450,6 +437,9 @@ sub outstanding_credits { > } > ); > >+ # sum returns undef if list is empty >+ my $total = sum( $lines->get_column('amountoutstanding') ) + 0; >+ > return ( $total, $lines ); > } > >diff --git a/t/db_dependent/Koha/Account.t b/t/db_dependent/Koha/Account.t >index 6c8e8b5cba..58b2444946 100755 >--- a/t/db_dependent/Koha/Account.t >+++ b/t/db_dependent/Koha/Account.t >@@ -67,7 +67,7 @@ subtest 'outstanding_debits() tests' => sub { > > subtest 'outstanding_credits() tests' => sub { > >- plan tests => 5; >+ plan tests => 7; > > $schema->storage->txn_begin; > >@@ -91,6 +91,10 @@ subtest 'outstanding_credits() tests' => sub { > $i++; > } > >+ ( $total, $lines ) = Koha::Account->new({ patron_id => 'InvalidBorrowernumber' })->outstanding_credits(); >+ is( $total, 0, "Total if no outstanding credits is 0" ); >+ is( $lines->count, 0, "With no outstanding credits, we get back a Lines object with 0 lines" ); >+ > $schema->storage->txn_rollback; > }; > >-- >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 20990
:
76380
|
76381
|
76405
|
76406
|
76407
|
76446
|
76447
|
76448
|
76449
|
76525
|
76640
|
76739
|
76740
|
76741
|
76742
|
76743