Bug 38728: Add automatic modal popup for cashups on register details page

This patch automatically triggers the cashup display modal after a
cashup is performed from the individual Register details display page.

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. Click on a register name to access the individual register page
6. Perform some transactions to create outstanding amounts
7. Click 'Record cashup' button on the register details page
8. Confirm the cashup in the modal dialog
9. Verify that after page reload, the cashup summary modal
   automatically opens showing the details of the cashup just performed

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Sally Healey <sally.healey@cheshiresharedservices.gov.uk>
Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Martin Renvoize 2025-06-24 14:03:34 +01:00 committed by Lucas Gass
parent 0a3ed65e70
commit c122b45af8
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
2 changed files with 11 additions and 2 deletions

View File

@ -573,6 +573,15 @@
}
]
}, null, 1);
$(document).ready(function() {
[% IF cashup_id %]
let $button = $('[data-cashup="[% cashup_id | html %]"]');
if ($button.length) {
$button[0].click();
}
[% END %]
});
</script>
[% END %]

View File

@ -104,7 +104,7 @@ if ( !$registers->count ) {
my $op = $input->param('op') // '';
if ( $op eq 'cud-cashup' ) {
if ( $logged_in_user->has_permission( { cash_management => 'cashup' } ) ) {
$cash_register->add_cashup(
my $cashup = $cash_register->add_cashup(
{
manager_id => $logged_in_user->id,
amount => $cash_register->outstanding_accountlines->total
@ -112,7 +112,7 @@ if ( !$registers->count ) {
);
# Redirect to prevent duplicate submissions (POST/REDIRECT/GET pattern)
print $input->redirect( "/cgi-bin/koha/pos/register.pl?registerid=" . $registerid );
print $input->redirect( "/cgi-bin/koha/pos/register.pl?registerid=" . $registerid . "&cashup_id=" . $cashup->id );
exit;
} else {
$template->param( error_cashup_permission => 1 );