From 42ff08c9f42045763a30c063e8bd30707f79b4fa Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 24 Jun 2025 14:03:50 +0100 Subject: [PATCH] Bug 38728: Add automatic modal popup for cashups in registers summary This patch automatically triggers the cashup display modal after a cashup is performed from the Cash registers summary page when performing a cashup on an individual register. Test plan: 1. Enable the point of sale system preference 2. Ensure you have permission for cash_management > cashup 3. Create at least one cash register for your current branch 4. Navigate to More > Point of Sale > Cash registers 5. Perform some transactions to create outstanding amounts 6. Click 'Record cashup' button on an individual register 7. Confirm the cashup in the modal dialog 8. Verify that after page reload, the cashup summary modal automatically opens showing the details of the cashup just performed Signed-off-by: Sally --- koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt | 7 +++++++ pos/registers.pl | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) 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 d345a60306b..7c9180a5975 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt @@ -231,6 +231,13 @@ var rid = button.data('registerid'); $('#cashup_confirm').attr("href", '/cgi-bin/koha/pos/registers.pl?op=cashup®isterid='+rid); }); + + [% IF cashup_id %] + let $button = $('[data-cashup="[% cashup_id | html %]"]'); + if ($button.length) { + $button[0].click(); + } + [% END %] }); [% END %] diff --git a/pos/registers.pl b/pos/registers.pl index 65accdf10c3..f6adec45b39 100755 --- a/pos/registers.pl +++ b/pos/registers.pl @@ -59,12 +59,13 @@ if ( $op eq 'cashup' ) { my $registerid = $input->param('registerid'); if ($registerid) { my $register = Koha::Cash::Registers->find( { id => $registerid } ); - $register->add_cashup( + my $cashup = $register->add_cashup( { manager_id => $logged_in_user->id, amount => $register->outstanding_accountlines->total } ); + $template->param( cashup_id => $cashup->id ); } else { for my $register ( $registers->as_list ) { $register->add_cashup( -- 2.51.0