diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 2d24bd2ab0f..b1998bf1518 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -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); diff --git a/htdocs/fourn/facture/document.php b/htdocs/fourn/facture/document.php index 5ffe26f07c7..5090f0c0838 100644 --- a/htdocs/fourn/facture/document.php +++ b/htdocs/fourn/facture/document.php @@ -239,6 +239,9 @@ if ($object->id > 0) print ''; print ''; + + dol_fiche_end(); + $modulepart = 'facture_fournisseur'; $permission = $user->rights->fournisseur->facture->creer; diff --git a/htdocs/langs/en_US/bills.lang b/htdocs/langs/en_US/bills.lang index ae5b3a3be1e..bd1f7bd2fc9 100644 --- a/htdocs/langs/en_US/bills.lang +++ b/htdocs/langs/en_US/bills.lang @@ -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