diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt index cb30d5456f..3e927e012f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/pay.tt @@ -64,6 +64,7 @@
[% INCLUDE 'csrf-token.inc' %] +
diff --git a/pos/pay.pl b/pos/pay.pl index 3c6f2a2d5e..45cd1119c8 100755 --- a/pos/pay.pl +++ b/pos/pay.pl @@ -58,30 +58,32 @@ my $invoice_types = {}, $library_id ); $template->param( invoice_types => $invoice_types ); -my $total_paid = $input->param('paid'); -if ( $total_paid and $total_paid ne '0.00' ) { - my $cash_register = Koha::Cash::Registers->find( { id => $registerid } ); - my $payment_type = $input->param('payment_type'); - my $sale = Koha::Charges::Sales->new( - { - cash_register => $cash_register, - staff_id => $logged_in_user->id +if ( $op eq 'cud-pay' ) { + my $total_paid = $input->param('paid'); + if ( $total_paid and $total_paid ne '0.00' ) { + my $cash_register = Koha::Cash::Registers->find( { id => $registerid } ); + my $payment_type = $input->param('payment_type'); + my $sale = Koha::Charges::Sales->new( + { + cash_register => $cash_register, + staff_id => $logged_in_user->id + } + ); + + my @sales = $input->multi_param('sales'); + for my $item (@sales) { + $item = from_json $item; + $sale->add_item($item); } - ); - my @sales = $input->multi_param('sales'); - for my $item (@sales) { - $item = from_json $item; - $sale->add_item($item); + my $payment = $sale->purchase( { payment_type => $payment_type } ); + + $template->param( + payment_id => $payment->accountlines_id, + collected => scalar $input->param('collected'), + change => scalar $input->param('change') + ); } - - my $payment = $sale->purchase( { payment_type => $payment_type } ); - - $template->param( - payment_id => $payment->accountlines_id, - collected => scalar $input->param('collected'), - change => scalar $input->param('change') - ); } if ( $op eq 'cud-send' ) {