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

Conflicts:
	htdocs/takepos/invoice.php
This commit is contained in:
Laurent Destailleur 2020-10-01 19:37:56 +02:00
commit 0fa139f4e3

View File

@ -224,10 +224,10 @@ if ($action == 'valid' && $user->rights->facture->creer)
// $conf->global->FACTURE_ADDON = $sav_FACTURE_ADDON; // $conf->global->FACTURE_ADDON = $sav_FACTURE_ADDON;
//} //}
$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;
@ -242,8 +242,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);