From 8b003f4b73a4e1ff8c21e2e6ac6f75b3abe3ba04 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 5 Mar 2020 14:16:33 +0000 Subject: [PATCH] Bug 24492: (RM follow-up) Redirect to correct page after cashup Cashup of a single register was resulting in a redirect to the register details page. It should return to the branch details page instead. Signed-off-by: Martin Renvoize --- .../intranet-tmpl/prog/en/modules/pos/registers.tt | 2 +- pos/registers.pl | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 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 f742601d11..0d07d3d8e2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt @@ -176,7 +176,7 @@ var rfloat = button.data('float'); $('#floatc').text(rfloat); var rid = button.data('registerid'); - $('#cashup_confirm').attr("href", '/cgi-bin/koha/pos/register.pl?op=cashup®isterid='+rid); + $('#cashup_confirm').attr("href", '/cgi-bin/koha/pos/registers.pl?op=cashup®isterid='+rid); }); }); diff --git a/pos/registers.pl b/pos/registers.pl index 3e8a39e11b..fafaf64fe1 100755 --- a/pos/registers.pl +++ b/pos/registers.pl @@ -55,13 +55,24 @@ else { my $op = $input->param('op') // ''; if ( $op eq 'cashup' ) { - for my $register ( $registers->as_list ) { + my $registerid = $input->param('registerid'); + if ( $registerid ) { + my $register = Koha::Cash::Registers->find( { id => $registerid } ); $register->add_cashup( { user_id => $logged_in_user->id, amount => $register->outstanding_accountlines->total } ); + } else { + for my $register ( $registers->as_list ) { + $register->add_cashup( + { + user_id => $logged_in_user->id, + amount => $register->outstanding_accountlines->total + } + ); + } } } -- 2.20.1