From 8df0242c75598c9e794490cfd588f6763423522c Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 9 Dec 2025 16:14:43 +0000 Subject: [PATCH] Bug 40445: (follow-up) Disable cashup button and checkbox when bankable is zero When a register has no bankable transactions (bankable amount is 0.00), the 'Record cashup' button and the corresponding checkbox should be disabled to prevent attempting a cashup that will result in an error. This patch: - Disables the checkbox for registers with 0.00 bankable amount - Disables the 'Record cashup' button when bankable is 0.00 - Adds tooltip "No bankable transactions" to both elements - Applies to both the registers summary page and individual register page Test plan: 1. Navigate to /cgi-bin/koha/pos/registers.pl 2. Find or create a register with no bankable transactions (0.00) 3. Verify the checkbox for that register is disabled with tooltip 4. Verify the 'Record cashup' button is disabled with tooltip 5. Navigate to the individual register page 6. Verify the toolbar 'Record cashup' button is disabled when bankable is 0.00 7. Verify registers with non-zero bankable amounts work as before --- koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt | 5 +++-- koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt index c7b29b96845..be22824bad9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt @@ -108,12 +108,13 @@ [% END %] + [% SET total_bankable = accountlines.total( payment_type => [ 'CASH', 'SIP00' ]) * -1 %] [% IF ( CAN_user_cash_management_cashup ) %]
[% IF cashup_in_progress %] [% ELSE %] - + [% END %]
[% END %] @@ -137,7 +138,7 @@
  • Float: [% register.starting_float | $Price %]
  • Total income (cash): [% accountlines.credits_total * -1 | $Price %] ([% accountlines.credits_total(payment_type => [ 'CASH', 'SIP00' ]) * -1 | $Price %])
  • Total outgoing (cash): [% accountlines.debits_total * -1 | $Price %] ([% accountlines.debits_total( payment_type => [ 'CASH', 'SIP00' ]) * -1 | $Price %])
  • -
  • Total bankable: [% accountlines.total( payment_type => [ 'CASH', 'SIP00' ]) * -1 | $Price %]
  • +
  • Total bankable: [% total_bankable | $Price %]
  • [% IF register.last_cashup %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt index e1ce660966b..3b06f81b402 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt @@ -156,11 +156,14 @@ [% SET bankable = 0, ctotal = 0, dtotal = 0, cctotal = 0, cdtotal = 0 %] [% FOREACH register IN registers %] + [% SET rbankable = ( register.outstanding_accountlines.total( payment_type => [ 'CASH', 'SIP00' ]) * -1 ) %] [% IF CAN_user_cash_management_cashup %] [% IF register.cashup_in_progress %] + [% ELSIF rbankable == 0 %] + [% ELSE %] [% END %] @@ -178,7 +181,6 @@ [% register.starting_float | $Price %] - [% SET rbankable = ( register.outstanding_accountlines.total( payment_type => [ 'CASH', 'SIP00' ]) * -1 ) %] [% SET bankable = bankable + rbankable %] [% rbankable | $Price %] @@ -220,6 +222,7 @@ data-bankable="[% rbankable | $Price %]" data-float="[% register.starting_float | $Price %]" data-registerid="[% register.id | html %]" + [% IF rbankable == 0 %]disabled title="No bankable transactions"[% END %] > Record cashup [% END %] -- 2.52.0