From b99d9b885b6b332a7648b1ebc5f264e089322896 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Wed, 21 Oct 2020 12:58:29 +0200 Subject: [PATCH] Bug 26760: Redirect to paycollect.pl when clicking on "Save and pay" Bug 14898 added the "Save and pay" button that redirects to "Make a payment" tab after creating a manual invoice This requires the user to click on another "Pay" button before being taken to the real payment form. By redirecting directly to paycollect.pl, this useless step will no longer be needed. Signed-off-by: Lisette Scheer Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer --- members/maninvoice.pl | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/members/maninvoice.pl b/members/maninvoice.pl index a178a2be38..1062f74f83 100755 --- a/members/maninvoice.pl +++ b/members/maninvoice.pl @@ -151,7 +151,7 @@ if ($add) { unless ($failed) { try { - $patron->account->add_debit( + my $line = $patron->account->add_debit( { amount => $amount, description => $desc, @@ -170,9 +170,18 @@ if ($add) { } if ( $add eq 'save and pay' ) { - print $input->redirect( - "/cgi-bin/koha/members/pay.pl?borrowernumber=$borrowernumber" + my $url = sprintf( + '/cgi-bin/koha/members/paycollect.pl?borrowernumber=%s&pay_individual=1&debit_type_code=%s&amount=%s&amountoutstanding=%s&description=%s&itemnumber=%s&accountlines_id=%s', + $borrowernumber, + $line->debit_type_code, + sprintf('%.2f', $line->amount), + sprintf('%.2f', $line->amountoutstanding), + $line->description, + $line->itemnumber, + $line->id ); + + print $input->redirect($url); } else { print $input->redirect( -- 2.11.0