Bug 34478: Manual fix - add op - pos/pay

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Martin Renvoize 2024-02-02 05:38:06 +00:00 committed by Jonathan Druart
parent 5c25dd0eec
commit a77182513a
No known key found for this signature in database
GPG Key ID: A085E712BEF0E0F0
2 changed files with 24 additions and 21 deletions

View File

@ -64,6 +64,7 @@
<form name="payForm" id="payForm" method="post" action="/cgi-bin/koha/pos/pay.pl">
[% INCLUDE 'csrf-token.inc' %]
<input type="hidden" name="op" value="cud-pay">
<div class="row">
<div class="col-md-6">

View File

@ -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' ) {