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 <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Martin Renvoize 2020-03-05 14:16:33 +00:00
parent 8f7a3bf5ea
commit 8b003f4b73
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
2 changed files with 13 additions and 2 deletions

View File

@ -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&registerid='+rid);
$('#cashup_confirm').attr("href", '/cgi-bin/koha/pos/registers.pl?op=cashup&registerid='+rid);
});
});
</script>

View File

@ -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
}
);
}
}
}