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).
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>
Created attachment 89315 [details] [review] Bug 22837: Update callers to use new signature
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>
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>
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>
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>
Created attachment 92972 [details] [review] Bug 22837: (follow-up) Fix some tests
Created attachment 92973 [details] [review] Bug 22837: (follow-up) Fix POD
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>
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>
Created attachment 92979 [details] [review] Bug 22837: (follow-up) Fix some tests Signed-off-by: Liz Rea <wizzyrea@gmail.com>
Created attachment 92980 [details] [review] Bug 22837: (follow-up) Fix POD Signed-off-by: Liz Rea <wizzyrea@gmail.com>
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>
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>
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>
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>
Nice work! Pushed to master for 19.11.00
Enhancement not pushed to 19.05.x