Bug 18805: Add ability to use up account credits
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 27 Nov 2018 23:28:29 +0000 (20:28 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 10 Dec 2018 09:58:56 +0000 (09:58 +0000)
commit235f6a83e2e6b8339070932dabcc81ecc9aefd41
tree58406d5770628b5ccebb3b66d15d817a0d5d2768
parent51a1a465c8b6264b7318ea90186ec29083c48d02
Bug 18805: Add ability to use up account credits

This patch introduces a new button in the 'Pay fines' tab  on the
patron's account page. This button, labeled 'Normalize account' is only
displayed when outstanding credits are available, that could be used to
pay up existing debts.

When clicking the button, the Koha::Account::normalize_balance method
(bug 21896) is used for the purpose.

To test:
- Apply this patch (on top of 21896)
- On a patron's 'Fines' tab, create a 'manual invoice' (maybe more than
  one)
- Go to the 'Pay fines' tab
=> SUCCESS: No 'Apply credits' button is displayed.
- On the 'create manual credit' tab, create a couple credits.
- Go to the 'Pay fines'
=> SUCCESS: 'Apply credits' button is displayed
- Click on 'Apply credits'
=> SUCCESS: Outstanding credits have been used to pay up debts.
- Play with different options (credit excedes debts and vice-versa, they
        match, etc)
=> SUCCESS: They all work as expected
- Sign off :-D

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit a3036b4760d80dd3d2188f5f95c6f4279ecef74b)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
koha-tmpl/intranet-tmpl/prog/en/modules/members/pay.tt
members/pay.pl