Merge branch '10.0' of git@github.com:Dolibarr/dolibarr.git into 11.0

Conflicts:
	htdocs/takepos/invoice.php
This commit is contained in:
Laurent Destailleur 2020-10-01 19:35:49 +02:00
commit 4d134ade72

View File

@ -198,10 +198,10 @@ if ($action == 'valid' && $user->rights->facture->creer)
$res = $invoice->validate($user); $res = $invoice->validate($user);
} }
$remaintopay = $invoice->getRemainToPay();
// Add the payment // Add the payment
if ($res >= 0 && $remaintopay > 0) { if ($res >= 0) {
$remaintopay = $invoice->getRemainToPay();
if ($remaintopay > 0) {
$payment = new Paiement($db); $payment = new Paiement($db);
$payment->datepaye = $now; $payment->datepaye = $now;
$payment->fk_account = $bankaccount; $payment->fk_account = $bankaccount;
@ -215,8 +215,9 @@ if ($action == 'valid' && $user->rights->facture->creer)
$payment->create($user); $payment->create($user);
$payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', '');
$remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded $remaintopay = $invoice->getRemainToPay(); // Recalculate remain to pay after the payment is recorded
}
if ($remaintopay == 0) { if ($remaintopay == 0) {
dol_syslog("Invoice is paid, so we set it to status Paid"); dol_syslog("Invoice is paid, so we set it to status Paid");
$result = $invoice->set_paid($user); $result = $invoice->set_paid($user);