From 1937baed7820a1a32f4fc7ec9dc1f32d37f389d6 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 5 Jul 2021 17:39:00 +0100 Subject: [PATCH] Bug 28656: Allow cancellations in the UI This allows cancellation against "reduced" as well as "unpaid" debts. --- Koha/Account/Line.pm | 10 ++++++++++ .../prog/en/modules/members/boraccount.tt | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index 23d48eb1cd..d97d96c0bd 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -360,6 +360,16 @@ sub void { return $void; } +=head3 can_be_cancelled + +=cut + +sub can_be_cancelled { + my ($self) = @_; + + return $self->debit_offsets->filter_by_reversable->count ? 1 : 0; +} + =head3 cancel $debit_accountline->cancel(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt index fd4484aeaa..56a96cb528 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt @@ -113,10 +113,10 @@ [% IF account.is_debit && account.amountoutstanding > 0 %] Pay [% END %] - [% IF account.is_credit && account.status != 'VOID' %] + [% IF account.is_credit && account.status != 'VOID' && !(account.credit_type_code == 'CANCELLATION') %] Void payment [% END %] - [% IF account.is_debit && account.amount == account.amountoutstanding && account.status != 'CANCELLED' && !(account.debit_type_code == 'PAYOUT') %] + [% IF account.is_debit && account.status != 'CANCELLED' && !(account.debit_type_code == 'PAYOUT') && !(account.debit_type_code == 'VOID') && !account.can_be_cancelled %]
-- 2.20.1