Bug 23442: Add 'reduce' method to Koha::Account::Line
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 21 Nov 2019 12:10:41 +0000 (12:10 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 10 Jan 2020 08:41:06 +0000 (08:41 +0000)
commit4b16375d2a1b94e792ba2f6042211b42536961b3
treecb8764ec591453c06df91340435542567cdf5e79
parent741f785b7f559da6a936ce30abcac53cbd695640
Bug 23442: Add 'reduce' method to Koha::Account::Line

This enhancement adds a 'reduce' method to Koha::Account::Line which can
be used to reduce a charge/debit by adding a credit to offset against
the amount outstanding.

It may be used to apply a discount whilst retaining the original debit
amounts or to apply a full or partial refund for example when a lost
item is found and returned.

The created credit will be immediately applied against the debit unless
the debit has already been paid, in which case a 'zero' offset will be
added to maintain a link to the debit but the outstanding credit will be
left so it may be applied to other debts.

Test Plan:
1) Run the included tests and verify they pass.
2) Signoff

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/Account/Line.pm
t/db_dependent/Koha/Account/Lines.t