Bug 20990 - Add Koha::Account::outstanding_credits
Summary: Add Koha::Account::outstanding_credits
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Testopia
URL:
Keywords:
Depends on: 20980
Blocks: 20942 21909
  Show dependency treegraph
 
Reported: 2018-06-25 14:01 UTC by Tomás Cohen Arazi
Modified: 2020-01-06 20:14 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 20990: Unit tests for Koha::Account->outstanding_credits (1.84 KB, patch)
2018-06-25 14:18 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 20990: Add Koha::Account->outstanding_credits (1.71 KB, patch)
2018-06-25 14:18 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 20990: Unit tests for Koha::Account->outstanding_credits (1.89 KB, patch)
2018-06-25 18:59 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 20990: Add Koha::Account->outstanding_credits (1.76 KB, patch)
2018-06-25 18:59 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 20990: (follow-up) Fix test description (1.03 KB, patch)
2018-06-25 18:59 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 20990: Unit tests for Koha::Account->outstanding_credits (1.97 KB, patch)
2018-06-26 14:32 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 20990: Add Koha::Account->outstanding_credits (1.84 KB, patch)
2018-06-26 14:32 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 20990: (follow-up) Fix test description (1.11 KB, patch)
2018-06-26 14:32 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 20990: Make same changes that were made to outstanding_debits (2.53 KB, patch)
2018-06-26 14:32 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 20990: Make same changes that were made to outstanding_debits (2.32 KB, patch)
2018-06-27 15:23 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 20990: (QA follow-up) make outstanding_credits return the account lines only (3.21 KB, patch)
2018-07-02 19:12 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 20990: Unit tests for Koha::Account->outstanding_credits (1.95 KB, patch)
2018-07-06 15:14 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 20990: Add Koha::Account->outstanding_credits (1.81 KB, patch)
2018-07-06 15:14 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 20990: (follow-up) Fix test description (1.09 KB, patch)
2018-07-06 15:14 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 20990: Make same changes that were made to outstanding_debits (2.32 KB, patch)
2018-07-06 15:14 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 20990: (QA follow-up) make outstanding_credits return the account lines only (3.21 KB, patch)
2018-07-06 15:14 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Tomás Cohen Arazi 2018-06-25 14:01:31 UTC
This will be handy for the /patrons/{patron_id}/account endpoint.
Comment 1 Tomás Cohen Arazi 2018-06-25 14:18:17 UTC
Created attachment 76380 [details] [review]
Bug 20990: Unit tests for Koha::Account->outstanding_credits
Comment 2 Tomás Cohen Arazi 2018-06-25 14:18:22 UTC
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
Comment 3 Josef Moravec 2018-06-25 18:59:49 UTC
Created attachment 76405 [details] [review]
Bug 20990: Unit tests for Koha::Account->outstanding_credits

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 4 Josef Moravec 2018-06-25 18:59:53 UTC
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>
Comment 5 Josef Moravec 2018-06-25 18:59:58 UTC
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>
Comment 6 Kyle M Hall 2018-06-26 14:32:14 UTC
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>
Comment 7 Kyle M Hall 2018-06-26 14:32:22 UTC
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>
Comment 8 Kyle M Hall 2018-06-26 14:32:25 UTC
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>
Comment 9 Kyle M Hall 2018-06-26 14:32:28 UTC
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>
Comment 10 Tomás Cohen Arazi 2018-06-27 15:23:14 UTC
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>
Comment 11 Tomás Cohen Arazi 2018-07-02 19:12:09 UTC
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>
Comment 12 Tomás Cohen Arazi 2018-07-06 15:14:20 UTC
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>
Comment 13 Tomás Cohen Arazi 2018-07-06 15:14:24 UTC
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>
Comment 14 Tomás Cohen Arazi 2018-07-06 15:14:28 UTC
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>
Comment 15 Tomás Cohen Arazi 2018-07-06 15:14:32 UTC
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>
Comment 16 Tomás Cohen Arazi 2018-07-06 15:14:36 UTC
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>
Comment 17 Nick Clemens 2018-07-13 11:26:20 UTC
Awesome work all!

Pushed to master for 18.11
Comment 18 Martin Renvoize 2018-07-15 19:09:17 UTC
Enhancement, not back porting to the 18.05.x series.
Comment 19 Martin Renvoize 2018-08-02 17:11:01 UTC
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.