Bug 22837 - Koha::Account::Line->apply should not require a 'set' of debits
Summary: Koha::Account::Line->apply should not require a 'set' of debits
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Martin Renvoize
QA Contact: Tomás Cohen Arazi
URL:
Keywords:
Depends on: 21607
Blocks:
  Show dependency treegraph
 
Reported: 2019-05-03 11:54 UTC by Martin Renvoize
Modified: 2020-11-30 21:44 UTC (History)
2 users (show)

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


Attachments
Bug 22837: Update apply to accept an arrayref (999 bytes, patch)
2019-05-03 12:31 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22837: Update callers to use new signature (9.72 KB, patch)
2019-05-03 12:31 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22837: Update apply to accept an arrayref (999 bytes, patch)
2019-05-03 14:13 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22837: Update callers to use new signature (10.01 KB, patch)
2019-05-03 14:13 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22837: Update apply to accept an arrayref (999 bytes, patch)
2019-05-08 11:36 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22837: Update callers to use new signature (10.00 KB, patch)
2019-05-08 11:36 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 22837: (follow-up) Fix some tests (1.28 KB, patch)
2019-09-19 18:41 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 22837: (follow-up) Fix POD (755 bytes, patch)
2019-09-19 18:45 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 22837: Update apply to accept an arrayref (1.02 KB, patch)
2019-09-19 18:54 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 22837: Update callers to use new signature (10.05 KB, patch)
2019-09-19 18:54 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 22837: (follow-up) Fix some tests (1.33 KB, patch)
2019-09-19 18:54 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 22837: (follow-up) Fix POD (799 bytes, patch)
2019-09-19 18:54 UTC, Liz Rea
Details | Diff | Splinter Review
Bug 22837: Update apply to accept an arrayref (1.07 KB, patch)
2019-09-19 18:59 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 22837: Update callers to use new signature (10.11 KB, patch)
2019-09-19 18:59 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 22837: (follow-up) Fix some tests (1.38 KB, patch)
2019-09-19 18:59 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 22837: (follow-up) Fix POD (854 bytes, patch)
2019-09-19 18:59 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 Martin Renvoize 2019-05-03 11:54:56 UTC
As it stands the apply method in Koha::Account::Line requires a Koha::Account resultset to be passed in as the list of debits to be applied against.  This is suboptimal when the method is often required to apply against the results of a Koha::Account::Line->find (single not set) as one needs to rework the query.

We should accept an arrayref of results rather than requiring a resultset as converting from a set to an arrayref is simple (->as_list), but converting for a single record up to a set is considerably more challenging (both coding wise and DB hits wise).
Comment 1 Martin Renvoize 2019-05-03 12:31:44 UTC
Created attachment 89314 [details] [review]
Bug 22837: Update apply to accept an arrayref

This patch update the signature of Koha::Account::Line->apply to accept
an arrayref of debits to apply against a credit instead of requireing a
Koha::Objects set.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 2 Martin Renvoize 2019-05-03 12:31:47 UTC
Created attachment 89315 [details] [review]
Bug 22837: Update callers to use new signature
Comment 3 Martin Renvoize 2019-05-03 14:13:14 UTC
Created attachment 89316 [details] [review]
Bug 22837: Update apply to accept an arrayref

This patch update the signature of Koha::Account::Line->apply to accept
an arrayref of debits to apply against a credit instead of requireing a
Koha::Objects set.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2019-05-03 14:13:16 UTC
Created attachment 89317 [details] [review]
Bug 22837: Update callers to use new signature

Test plan:
Run t/db_dependent/Circulation.t, t/db_dependent/Koha/Account.t,
t/db_dependent/Koha/Account/Lines.t and
t/db_dependent/api/v1/patrons_accounts.t and all should pass.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize 2019-05-08 11:36:27 UTC
Created attachment 89468 [details] [review]
Bug 22837: Update apply to accept an arrayref

This patch update the signature of Koha::Account::Line->apply to accept
an arrayref of debits to apply against a credit instead of requireing a
Koha::Objects set.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 6 Martin Renvoize 2019-05-08 11:36:30 UTC
Created attachment 89469 [details] [review]
Bug 22837: Update callers to use new signature

Test plan:
Run t/db_dependent/Circulation.t, t/db_dependent/Koha/Account.t,
t/db_dependent/Koha/Account/Lines.t and
t/db_dependent/api/v1/patrons_accounts.t and all should pass.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 7 Tomás Cohen Arazi 2019-09-19 18:41:32 UTC
Created attachment 92972 [details] [review]
Bug 22837: (follow-up) Fix some tests
Comment 8 Tomás Cohen Arazi 2019-09-19 18:45:14 UTC
Created attachment 92973 [details] [review]
Bug 22837: (follow-up) Fix POD
Comment 9 Liz Rea 2019-09-19 18:54:15 UTC
Created attachment 92977 [details] [review]
Bug 22837: Update apply to accept an arrayref

This patch update the signature of Koha::Account::Line->apply to accept
an arrayref of debits to apply against a credit instead of requireing a
Koha::Objects set.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 10 Liz Rea 2019-09-19 18:54:30 UTC
Created attachment 92978 [details] [review]
Bug 22837: Update callers to use new signature

Test plan:
Run t/db_dependent/Circulation.t, t/db_dependent/Koha/Account.t,
t/db_dependent/Koha/Account/Lines.t and
t/db_dependent/api/v1/patrons_accounts.t and all should pass.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 11 Liz Rea 2019-09-19 18:54:33 UTC
Created attachment 92979 [details] [review]
Bug 22837: (follow-up) Fix some tests

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 12 Liz Rea 2019-09-19 18:54:36 UTC
Created attachment 92980 [details] [review]
Bug 22837: (follow-up) Fix POD

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Comment 13 Tomás Cohen Arazi 2019-09-19 18:59:11 UTC
Created attachment 92981 [details] [review]
Bug 22837: Update apply to accept an arrayref

This patch update the signature of Koha::Account::Line->apply to accept
an arrayref of debits to apply against a credit instead of requireing a
Koha::Objects set.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 14 Tomás Cohen Arazi 2019-09-19 18:59:15 UTC
Created attachment 92982 [details] [review]
Bug 22837: Update callers to use new signature

Test plan:
Run t/db_dependent/Circulation.t, t/db_dependent/Koha/Account.t,
t/db_dependent/Koha/Account/Lines.t and
t/db_dependent/api/v1/patrons_accounts.t and all should pass.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 15 Tomás Cohen Arazi 2019-09-19 18:59:20 UTC
Created attachment 92983 [details] [review]
Bug 22837: (follow-up) Fix some tests

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 16 Tomás Cohen Arazi 2019-09-19 18:59:23 UTC
Created attachment 92984 [details] [review]
Bug 22837: (follow-up) Fix POD

Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 17 Martin Renvoize 2019-09-23 10:09:54 UTC
Nice work!

Pushed to master for 19.11.00
Comment 18 Fridolin Somers 2019-09-24 07:02:01 UTC
Enhancement not pushed to 19.05.x