From a77182513a1f3af4568490c045e8b64b82c7900a Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 2 Feb 2024 05:38:06 +0000 Subject: [PATCH] Bug 34478: Manual fix - add op - pos/pay Signed-off-by: Jonathan Druart --- .../intranet-tmpl/prog/en/modules/pos/pay.tt | 1 + pos/pay.pl | 44 ++++++++++--------- 2 files changed, 24 insertions(+), 21 deletions(-) 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 } ); + 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') - ); + $template->param( + payment_id => $payment->accountlines_id, + collected => scalar $input->param('collected'), + change => scalar $input->param('change') + ); + } } if ( $op eq 'cud-send' ) { -- 2.39.5