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 <lisetteslatah@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Julian Maurice 2020-10-21 12:58:29 +02:00 committed by Kyle M Hall
parent 43e7873637
commit 5b40df23e3

View file

@ -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(