Bug 29759: Make cancelling an AR refund
authorTomas Cohen Arazi <tomascohen@theke.io>
Wed, 22 Dec 2021 21:17:37 +0000 (18:17 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Tue, 1 Feb 2022 07:55:39 +0000 (21:55 -1000)
commit3ac2e046e8215b9f6b127c64e19c4728d45acae7
tree26c21d15de953b1109fb4fea9adc9bb137336a61
parentf0886ce27c0f1e1eeef3f472a53718363d148534
Bug 29759: Make cancelling an AR refund

This patch makes the Koha::ArticleRequest->cancel method perform a
refund if it applies.

The sequence is:
- Find refundable (potentially partial) payments against the fee
- Generate a refund for the refundable amount
- Reduce the fee to zero
=> RESULT: the patron owes nothing, any credits applied to the debit are
refunded.

1. Apply the unit tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/ArticleRequest.t
=> FAIL: Nothing is refunded
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! Refunds take place!
5. Try on the UI
=> SUCCESS: All good
6. Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Koha/ArticleRequest.pm