Merge pull request #6246 from atm-florian/develop

NEW : supplier invoice : calculation of limit payment date on update
This commit is contained in:
Laurent Destailleur 2017-01-27 01:46:43 +01:00 committed by GitHub
commit 87a74e78b6
2 changed files with 33 additions and 22 deletions

View File

@ -321,9 +321,20 @@ if (empty($reshook))
if (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE)) setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings'); if (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE)) setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings');
else setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings'); else setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings');
} }
$object->fetch($id); $object->fetch($id);
$object->date=$newdate; $object->date=$newdate;
if ($object->date_echeance && $object->date_echeance < $object->date) $object->date_echeance=$object->date; $date_echence_calc=$object->calculate_date_lim_reglement();
if (!empty($object->date_echeance) && $object->date_echeance < $date_echence_calc)
{
$object->date_echeance = $date_echence_calc;
}
if ($object->date_echeance && $object->date_echeance < $object->date)
{
$object->date_echeance=$object->date;
}
$result=$object->update($user); $result=$object->update($user);
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
} }