This will be handy for the /patrons/{patron_id}/account endpoint.
Created attachment 76380 [details] [review] Bug 20990: Unit tests for Koha::Account->outstanding_credits
Created attachment 76381 [details] [review] Bug 20990: Add Koha::Account->outstanding_credits This patch adds a method that retrieves (for a patron's account) the outstanding credits (i.e. those that haven't been applied to any debit. To test: - Apply this patches - Run: $ kshell k$ prove t/db_dependent/Koha/Account.t => SUCCESS: Tests pass! - Sign off :-D
Created attachment 76405 [details] [review] Bug 20990: Unit tests for Koha::Account->outstanding_credits Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 76406 [details] [review] Bug 20990: Add Koha::Account->outstanding_credits This patch adds a method that retrieves (for a patron's account) the outstanding credits (i.e. those that haven't been applied to any debit. To test: - Apply this patches - Run: $ kshell k$ prove t/db_dependent/Koha/Account.t => SUCCESS: Tests pass! - Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 76407 [details] [review] Bug 20990: (follow-up) Fix test description Test plan: prove -v t/db_dependent/Koha/Account.t --> Test message of first test of subtest outtanding_credits correctly says "Outstanding credits total..." Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Created attachment 76446 [details] [review] Bug 20990: Unit tests for Koha::Account->outstanding_credits Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 76447 [details] [review] Bug 20990: Add Koha::Account->outstanding_credits This patch adds a method that retrieves (for a patron's account) the outstanding credits (i.e. those that haven't been applied to any debit. To test: - Apply this patches - Run: $ kshell k$ prove t/db_dependent/Koha/Account.t => SUCCESS: Tests pass! - Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 76448 [details] [review] Bug 20990: (follow-up) Fix test description Test plan: prove -v t/db_dependent/Koha/Account.t --> Test message of first test of subtest outtanding_credits correctly says "Outstanding credits total..." Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 76449 [details] [review] Bug 20990: Make same changes that were made to outstanding_debits Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 76525 [details] [review] Bug 20990: Make same changes that were made to outstanding_debits Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 76640 [details] [review] Bug 20990: (QA follow-up) make outstanding_credits return the account lines only This patch was discussed with Jonathan on a QA conversation. It is better to keep this simpler and more reusable. And is the right approach in this case. This patch makes Koha::Account::outstanding_credits return the account lines, code that used the $total value, will just use $lines->total_outstanding; Tests are adjusted accordingly. To test: - Run: $ kshell k$ prove t/db_dependent/Koha/Account.t => SUCCESS: Test pass. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 76739 [details] [review] Bug 20990: Unit tests for Koha::Account->outstanding_credits Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 76740 [details] [review] Bug 20990: Add Koha::Account->outstanding_credits This patch adds a method that retrieves (for a patron's account) the outstanding credits (i.e. those that haven't been applied to any debit. To test: - Apply this patches - Run: $ kshell k$ prove t/db_dependent/Koha/Account.t => SUCCESS: Tests pass! - Sign off :-D Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 76741 [details] [review] Bug 20990: (follow-up) Fix test description Test plan: prove -v t/db_dependent/Koha/Account.t --> Test message of first test of subtest outtanding_credits correctly says "Outstanding credits total..." Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 76742 [details] [review] Bug 20990: Make same changes that were made to outstanding_debits Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 76743 [details] [review] Bug 20990: (QA follow-up) make outstanding_credits return the account lines only This patch was discussed with Jonathan on a QA conversation. It is better to keep this simpler and more reusable. And is the right approach in this case. This patch makes Koha::Account::outstanding_credits return the account lines, code that used the $total value, will just use $lines->total_outstanding; Tests are adjusted accordingly. To test: - Run: $ kshell k$ prove t/db_dependent/Koha/Account.t => SUCCESS: Test pass. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Awesome work all! Pushed to master for 18.11
Enhancement, not back porting to the 18.05.x series.
Reconsideration of that last comment, I've now Pushed to 18.05.x branch for 18.05.03. This was done to unblock the chain of dependencies for bug 20942 which is a helpful enhancement encouraging third-party API integrations.