From 9c638968ff993a1c96ab07ed36cf8d7ac5da35ea Mon Sep 17 00:00:00 2001 From: tnegre Date: Fri, 26 Jan 2024 16:00:17 +0100 Subject: [PATCH] Takepos : display errors on payment error --- htdocs/takepos/invoice.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 4130ac5c3cb..db223e58f9c 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -305,7 +305,11 @@ if ($action == 'valid' && $user->rights->facture->creer) { if ($pay != "delayed") { $payment->create($user); - $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); + $res = $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); + if ($res < 0) { + $error++; + dol_htmloutput_errors($langs->trans('ErrorNoPaymentDefined'), $payment->errors, 1); + } $remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded } }