Bug 21673

Summary: Koha::Account::Lines->total_outstanding must be used when needed
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Fines and feesAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Martin Renvoize <martin.renvoize>
Severity: enhancement    
Priority: P5 - low CC: nick, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17140
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 13098    
Bug Blocks: 21696    
Attachments: Bug 21673: Use Koha::Account::Lines->total_amountoutstanding when needed
Bug 21673: Use Koha::Account::Lines->total_amountoutstanding when needed
Bug 21673: (QA follow-up) Fix typo and remove unused library
Bug 21673: Use Koha::Account::Lines->total_amountoutstanding when needed
Bug 21673: (QA follow-up) Fix typo and remove unused library

Description Jonathan Druart 2018-10-25 19:55:21 UTC
There are several times the same pattern to retrieve the sum of amountoutstanding columns for Koha::Account::Line set.
We should use Koha::Account::Lines->total_outstanding instead.
Comment 1 Jonathan Druart 2018-10-25 19:56:34 UTC
Created attachment 81196 [details] [review]
Bug 21673: Use Koha::Account::Lines->total_amountoutstanding when needed

There are several times the same pattern to retrieve the sum of
amountoutstanding columns for Koha::Account::Line set.
We should use Koha::Account::Lines->total_outstanding instead.
Comment 2 Martin Renvoize 2018-10-26 19:10:51 UTC
Comment on attachment 81196 [details] [review]
Bug 21673: Use Koha::Account::Lines->total_amountoutstanding when needed

Review of attachment 81196 [details] [review]:
-----------------------------------------------------------------

::: Koha/Account/Lines.pm
@@ -46,4 @@
>  sub total_outstanding {
>      my ( $self ) = @_;
>  
> -    my $total = sum0( $self->get_column('amountoutstanding') );

You've removed the only use of sum0, but not removed the List::Util import above ;)
Comment 3 Tomás Cohen Arazi 2018-10-27 11:43:32 UTC
Created attachment 81355 [details] [review]
Bug 21673: Use Koha::Account::Lines->total_amountoutstanding when needed

There are several times the same pattern to retrieve the sum of
amountoutstanding columns for Koha::Account::Line set.
We should use Koha::Account::Lines->total_outstanding instead.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Tomás Cohen Arazi 2018-10-27 11:43:39 UTC
Created attachment 81356 [details] [review]
Bug 21673: (QA follow-up) Fix typo and remove unused library

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 5 Martin Renvoize 2018-10-31 15:07:46 UTC
Created attachment 81744 [details] [review]
Bug 21673: Use Koha::Account::Lines->total_amountoutstanding when needed

There are several times the same pattern to retrieve the sum of
amountoutstanding columns for Koha::Account::Line set.
We should use Koha::Account::Lines->total_outstanding instead.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 6 Martin Renvoize 2018-10-31 15:07:51 UTC
Created attachment 81745 [details] [review]
Bug 21673: (QA follow-up) Fix typo and remove unused library

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Martin Renvoize 2018-10-31 15:08:48 UTC
Nice bit of cleaning up..

Passing QA
Comment 8 Nick Clemens (kidclamp) 2018-11-06 17:56:26 UTC
Awesome work all!

Pushed to master for 18.11
Comment 9 Martin Renvoize 2018-11-16 12:35:50 UTC
Enhancement, will not be backported for 18.05.x series.