Bug 24603: Allow to cancel charges in patron accounting
commit8d2259b67443f75675733d41773d153d889dffd7
authorJulian Maurice <julian.maurice@biblibre.com>
Thu, 6 Feb 2020 13:13:44 +0000 (6 14:13 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 10 Nov 2020 14:00:09 +0000 (10 15:00 +0100)
tree2e9c12cfe767742cffad3eb79b55cf8e8198a4ee
parent904e926ba0f407b24aa3d94be5afe37b5e3ec075
Bug 24603: Allow to cancel charges in patron accounting

There is already a button to void a payment. It should be possible to
cancel a charge too.

This patch adds a button in patron's accounting section (Transactions
tab) that allow to cancel charges.
Charges that have been fully or partially paid cannot be cancelled.

It also fixes Koha::Account::Line::is_credit by looking at
credit_type_code instead of amount (amount can be 0 for voided payments)

It also fixes the tests for Koha::Account::Line::void when database does
not contain the borrowernumber 51 (the default in
t::lib::Mocks::mock_userenv)

Test plan:
1. Go to a patron's accounting section
2. Create a manual invoice
3. In Transactions tab, you should see a 'Cancel charge' button. Click
   on it. It should now be marked as cancelled
4. Create another manual invoice
5. Pay it (partially or fully)
6. Notice that the 'Cancel charge' button is not available
7. Void the payment
8. 'Cancel charge' button is available again. Click on it and verify
   that it still works
9. prove t/db_dependent/Koha/Account/Lines.t

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Koha/Account/Line.pm
koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc
koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt
members/boraccount.pl
members/cancel-charge.pl [new file with mode: 0755]
t/db_dependent/Koha/Account/Line.t