Fix status paid after entering a payment

This commit is contained in:
Laurent Destailleur 2019-03-27 20:28:02 +01:00
parent 9105e205ff
commit eb1d57226f

View File

@ -116,9 +116,16 @@ if ($action == 'valid' && $user->rights->facture->creer)
$payment->create($user);
$payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', '');
if ($invoice->getRemainToPay() == 0)
$remaintopay = $invoice->getRemainToPay();
if ($remaintopay == 0)
{
dol_syslog("Invoice is paid, so we set it to pay");
$result = $invoice->set_paid($user);
if ($result > 0) $invoice->paye = 1;
}
else
{
dol_syslog("Invoice is not paid, remain to pay = ".$remaintopay);
}
}