|
Lines 56-71
if ( !$registers->count ) {
Link Here
|
| 56 |
my $op = $input->param('op') // ''; |
56 |
my $op = $input->param('op') // ''; |
| 57 |
if ( $op eq 'cud-cashup' ) { |
57 |
if ( $op eq 'cud-cashup' ) { |
| 58 |
if ( $logged_in_user->has_permission( { cash_management => 'cashup' } ) ) { |
58 |
if ( $logged_in_user->has_permission( { cash_management => 'cashup' } ) ) { |
| 59 |
my $registerid = $input->param('registerid'); |
59 |
my $registerid = $input->param('registerid'); |
|
|
60 |
my $redirect_url = "/cgi-bin/koha/pos/registers.pl"; |
| 60 |
if ($registerid) { |
61 |
if ($registerid) { |
| 61 |
my $register = Koha::Cash::Registers->find( { id => $registerid } ); |
62 |
my $register = Koha::Cash::Registers->find( { id => $registerid } ); |
| 62 |
my $cashup = $register->add_cashup( |
63 |
my $cashup = $register->add_cashup( |
| 63 |
{ |
64 |
{ |
| 64 |
manager_id => $logged_in_user->id, |
65 |
manager_id => $logged_in_user->id, |
| 65 |
amount => $register->outstanding_accountlines->total |
66 |
amount => $register->outstanding_accountlines->total |
| 66 |
} |
67 |
} |
| 67 |
); |
68 |
); |
| 68 |
$template->param( cashup_id => $cashup->id ); |
69 |
$redirect_url .= "#cashup-" . $cashup->id; |
| 69 |
} else { |
70 |
} else { |
| 70 |
for my $register ( $registers->as_list ) { |
71 |
for my $register ( $registers->as_list ) { |
| 71 |
$register->add_cashup( |
72 |
$register->add_cashup( |
|
Lines 78-84
if ( $op eq 'cud-cashup' ) {
Link Here
|
| 78 |
} |
79 |
} |
| 79 |
|
80 |
|
| 80 |
# Redirect to prevent duplicate submissions (POST/REDIRECT/GET pattern) |
81 |
# Redirect to prevent duplicate submissions (POST/REDIRECT/GET pattern) |
| 81 |
print $input->redirect("/cgi-bin/koha/pos/registers.pl"); |
82 |
print $input->redirect($redirect_url); |
| 82 |
exit; |
83 |
exit; |
| 83 |
} else { |
84 |
} else { |
| 84 |
$template->param( error_cashup_permission => 1 ); |
85 |
$template->param( error_cashup_permission => 1 ); |
| 85 |
- |
|
|