]> git.koha-community.org Git - koha.git/commit
Bug 27995: Update return for Koha::Account::Line->apply
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 19 Mar 2021 10:52:54 +0000 (10:52 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 27 Apr 2021 14:23:49 +0000 (16:23 +0200)
commitfb3a67f21b90433fa73bf8a739f1508e226025b0
treebbcad0cea72098e721a48503f8e0b44a0c32b83f
parent479c8d997e3c73415861b5d15b6bf207d6c59ca1
Bug 27995: Update return for Koha::Account::Line->apply

This patch updates the return value of Koha::Account::Line->apply to return the
updated Koha::Account::Line object with Koha::Object::Messages embedded
for the results of any triggered renewals.

Available credit, the former return value, is still availabe via the
object directly as `amountoutstanding`.

Koha::REST::V1::Patrons::Account->add_credit has been updated to reflect
the change. No other area's of Koha relied upon the return value.

This patch also fixes a bug whereby if you passed a list of debits with
an outstanding debit larger than the outstanding credit then you could
end up with superflous offest lines with zero amounts that was
highlighted by the improved unit tests in
t/db_dependent/Koha/Account/Line.t

Test plan
1/ Run t/db_dependent/Koha/Account/Line.t
2/ Run t/db_dependent/api/v1/patrons_accounts.t
3/ If both tests pass then signoff

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Account/Line.pm
Koha/REST/V1/Patrons/Account.pm