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

@ -221,7 +221,7 @@ if ($id > 0 && ! preg_match('/^add/i',$action))
dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', '', 0); dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', '', 0);
print '<div class="underbanner clearboth"></div>'; print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td class="titlefield">'; print '<tr><td class="titlefield">';

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);
} }