Facture: enhance validation by adding INVOICE_CHECK_POSTERIOR_DATE option

This commit is contained in:
Thomas Negre 2022-03-02 10:16:14 +01:00
parent ad416ef792
commit eda9622c9c

View File

@ -2671,6 +2671,13 @@ class Facture extends CommonInvoice
dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS='.$conf->global->MAIN_USE_ADVANCED_PERMS, LOG_ERR);
return -1;
}
if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) {
$last_of_type = $this->willBeLastOfSameType();
if (!$last_of_type[0]) {
$this->error = $langs->transnoentities("ErrorInvoiceIsNotLastOfSameType", $this->ref , dol_print_date($this->date, 'day'), dol_print_date($last_of_type[1], 'day'));
return -1;
}
}
$this->db->begin();