https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28656 --- Comment #25 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 211453 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=211453&action=edit Bug 28656: Allow cancelling paid and partially paid debits Koha::Account::Line->cancel refused any debit that had been paid, even in part, and the Cancel charge button was only shown for debits that had not been touched at all. Allow it. What the patron paid is given back as credit on their account, and the debit is cancelled with nothing outstanding: * The cancellation is for what is still owed plus the payments made against the debit. Payments that have been voided are not counted. * Only payments are given back. Discounts, writeoffs, refunds and other credits that were not paid by the patron are not. * The part that is still owed is applied to the debit, the rest is left as outstanding credit that can be used on other charges or paid out. A debit with nothing outstanding stays linked to its cancellation by a zero amount offset, as reduce does. * Void debits cannot be cancelled, as is already the case for reduce. The Cancel charge button is now shown for every debit that is not already cancelled, a payout or a void, and the dialog says what happens to the money that was paid. To test: 1. Create two charges for a patron, for example from Accounting > Create manual invoice, of 20 and of 10 2. Pay 5 against the first charge 3. Go to the patron's Accounting > Transactions => Both charges have a Cancel charge button 4. Cancel the first charge => The dialog explains that what was paid is added as credit 5. Confirm => The charge shows as cancelled with nothing outstanding => 5 is left as credit on the account 6. Cancel the second charge => It is cancelled as before, with no credit left 7. Add a charge of 20, pay it in full and cancel it => 20 is left as credit 8. Run $ prove t/db_dependent/Koha/Account/Line.t => SUCCESS: Tests pass! 9. Sign off -- You are receiving this mail because: You are watching all bug changes.