From 61d1acf67817377c1d8be6c3a63585bed41aca22 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 17 Dec 2024 13:59:35 +0000 Subject: [PATCH] Bug 38726: Add automatic modal popup for cashups This patch automatically triggers the cashup display modal after a cashup is performed from the Register (singular) details display page. --- koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt | 9 +++++++++ pos/register.pl | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) 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 1824a3efcb4..27aac9e4a63 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt @@ -480,6 +480,15 @@ } ] }, null, 1); + + $(document).ready(function() { + [% IF cashup_id %] + let $button = $('[data-cashup="[% cashup_id | html %]"]'); + if ($button.length) { + $button[0].click(); + } + [% END %] + }); [% END %] diff --git a/pos/register.pl b/pos/register.pl index 53bb5d23253..ca8ded1d673 100755 --- a/pos/register.pl +++ b/pos/register.pl @@ -106,12 +106,14 @@ else { my $op = $input->param('op') // ''; if ( $op eq '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 } ); + $template->param( cashup_id => $cashup->id ); + $template->param( cashup_description => "Some stuff here" ); } else { $template->param( error_cashup_permission => 1 ); -- 2.47.1