From c1c50b93752b0efe0f707db6b8e5552833696f68 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 19 Sep 2025 13:56:28 +0100 Subject: [PATCH] Bug 40445: Implement unified "Cashup selected" functionality with checkbox selection This commit replaces the 'Cashup all' option on the branch registers page with a checkbox-based selection system that allows staff to selectively process multiple registers using either quick or two-phase cashup workflows. Changes include: 1. Enhanced registers page template: - Added checkbox column with "Select all" functionality - Replaced "Cashup all" with "Cashup selected" in footer - Added comprehensive modal offering both workflow options - Implemented JavaScript for checkbox state management - Added indeterminate state handling for partial selections 2. Updated register.pl operation handlers: - Enhanced cud-cashup_start to handle comma-separated register IDs - Modified cud-cashup to support both single register reconciliation and multiple register quick cashup - Added comprehensive error handling for bulk operations - Maintained backward compatibility with single register operations 3. Unified approach: - Reuses existing operations instead of creating new ones - Supports both single and multiple register processing - Provides appropriate redirects based on operation scope The implementation allows libraries to: - Select specific registers for cashup processing - Choose between quick cashup (immediate completion) or two-phase workflow (start now, complete later) - Process multiple registers efficiently while maintaining individual reconciliation capability - Handle mixed register states appropriately --- .../prog/en/modules/pos/registers.tt | 244 +++++++++++++++++- pos/register.pl | 1 - pos/registers.pl | 140 ++++++++-- 3 files changed, 353 insertions(+), 32 deletions(-) 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 a9d8e5c00e2..e1ce660966b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt @@ -45,9 +45,83 @@
You do not have permission to perform cashup actions.
[% END %] - [% IF CAN_user_cash_management_cashup %] -
- + [% IF ( error_cashup_start && cashup_errors ) %] +
+ Some registers failed to start cashup: +
    + [% FOREACH error IN cashup_errors %] +
  • [% error | html %]
  • + [% END %] +
+
+ [% END %] + + [% IF ( error_cashup_complete && cashup_errors ) %] +
+ Some registers failed to complete cashup: +
    + [% FOREACH error IN cashup_errors %] +
  • [% error | html %]
  • + [% END %] +
+
+ [% END %] + + [% IF ( cashup_start_success ) %] +
+ + [% IF cashup_start_success == 1 %] + Successfully started cashup for 1 register. + [% ELSE %] + Successfully started cashup for [% cashup_start_success | html %] registers. + [% END %] + [% IF ( cashup_start_errors ) %] + [% IF cashup_start_errors == 1 %] + However, 1 register had errors. + [% ELSE %] + However, [% cashup_start_errors | html %] registers had errors. + [% END %] + [% END %] +
+ [% END %] + + [% IF ( cashup_complete_success ) %] +
+ + [% IF cashup_complete_success == 1 %] + Successfully completed cashup for 1 register. + [% ELSE %] + Successfully completed cashup for [% cashup_complete_success | html %] registers. + [% END %] + [% IF ( cashup_complete_errors ) %] + [% IF cashup_complete_errors == 1 %] + However, 1 register had errors. + [% ELSE %] + However, [% cashup_complete_errors | html %] registers had errors. + [% END %] + [% END %] +
+ [% END %] + + [% IF ( cashup_start_errors && !cashup_start_success ) %] +
+ + [% IF cashup_start_errors == 1 %] + Failed to start cashup for 1 register. + [% ELSE %] + Failed to start cashup for [% cashup_start_errors | html %] registers. + [% END %] +
+ [% END %] + + [% IF ( cashup_complete_errors && !cashup_complete_success ) %] +
+ + [% IF cashup_complete_errors == 1 %] + Failed to complete cashup for 1 register. + [% ELSE %] + Failed to complete cashup for [% cashup_complete_errors | html %] registers. + [% END %]
[% END %] @@ -64,6 +138,9 @@ + [% IF CAN_user_cash_management_cashup %] + + [% END %] @@ -80,6 +157,15 @@ [% SET bankable = 0, ctotal = 0, dtotal = 0, cctotal = 0, cdtotal = 0 %] [% FOREACH register IN registers %] + [% IF CAN_user_cash_management_cashup %] + + [% END %] - + [% IF CAN_user_cash_management_cashup %] + + [% ELSE %] + + [% END %] [% IF CAN_user_cash_management_cashup %] [% END %] @@ -203,6 +295,68 @@ + + + +
Register name Register description Last cashup
+ [% IF register.cashup_in_progress %] + + [% ELSE %] + + [% END %] + [% register.name | html %] [% register.description | html %] @@ -144,13 +230,19 @@
Totals:Totals:Totals:[% bankable | $Price %] [% ctotal | $Price %] ([% cctotal | $Price %]) [% dtotal | $Price %] ([% cdtotal | $Price %]) - +