Fix date of invoice in future.

This commit is contained in:
Laurent Destailleur 2017-01-22 23:00:40 +01:00
parent db220e7af5
commit b011d6e188
3 changed files with 12 additions and 1 deletions

View File

@ -315,8 +315,14 @@ if (empty($reshook))
}
elseif ($action == 'setdatef' && $user->rights->fournisseur->facture->creer)
{
$newdate=dol_mktime(0,0,0,$_POST['datefmonth'],$_POST['datefday'],$_POST['datefyear']);
if ($newdate > (dol_now() + (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE)?0:$conf->global->INVOICE_MAX_OFFSET_IN_FUTURE)))
{
if (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE)) setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings');
else setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings');
}
$object->fetch($id);
$object->date=dol_mktime(12,0,0,$_POST['datefmonth'],$_POST['datefday'],$_POST['datefyear']);
$object->date=$newdate;
if ($object->date_echeance && $object->date_echeance < $object->date) $object->date_echeance=$object->date;
$result=$object->update($user);
if ($result < 0) dol_print_error($db,$object->error);

View File

@ -239,6 +239,9 @@ if ($object->id > 0)
print '</table>';
print '</div>';
dol_fiche_end();
$modulepart = 'facture_fournisseur';
$permission = $user->rights->fournisseur->facture->creer;

View File

@ -333,6 +333,8 @@ InvoiceAutoValidate=Validate invoices automatically
GeneratedFromRecurringInvoice=Generated from template recurring invoice %s
DateIsNotEnough=Date not reached yet
InvoiceGeneratedFromTemplate=Invoice %s generated from recurring template invoice %s
WarningInvoiceDateInFuture=Warning, the invoice date is higher than current date
WarningInvoiceDateTooFarInFuture=Warning, the invoice date is too far from current date
# PaymentConditions
Statut=Status
PaymentConditionShortRECEP=Due Upon Receipt