FIX: Fix when options FAC_FORCE_DATE_VALIDATION and INVOICE_CHECK_POSTERIOR_DATE enabled. The date is forced after the test and not before
This commit is contained in:
parent
de98256fd4
commit
116ff4a985
2 changed files with 12 additions and 4 deletions
|
|
@ -315,6 +315,12 @@ if (empty($reshook)) {
|
|||
// Validation
|
||||
$object->fetch($id);
|
||||
|
||||
if ((preg_match('/^[\(]?PROV/i', $object->ref) || empty($object->ref)) && // empty should not happened, but when it occurs, the test save life
|
||||
!empty($conf->global->FAC_FORCE_DATE_VALIDATION) // If option enabled, we force invoice date
|
||||
) {
|
||||
$object->date = dol_now();
|
||||
}
|
||||
|
||||
if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) {
|
||||
$last_of_type = $object->willBeLastOfSameType(true);
|
||||
if (empty($object->date_validation) && !$last_of_type[0]) {
|
||||
|
|
|
|||
|
|
@ -3228,6 +3228,12 @@ 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 ((preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) && // empty should not happened, but when it occurs, the test save life
|
||||
!empty($conf->global->FAC_FORCE_DATE_VALIDATION) // If option enabled, we force invoice date
|
||||
) {
|
||||
$this->date = dol_now();
|
||||
$this->date_lim_reglement = $this->calculate_date_lim_reglement();
|
||||
}
|
||||
if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) {
|
||||
$last_of_type = $this->willBeLastOfSameType(true);
|
||||
if (!$last_of_type[0]) {
|
||||
|
|
@ -3340,10 +3346,6 @@ class Facture extends CommonInvoice
|
|||
if ($force_number) {
|
||||
$num = $force_number;
|
||||
} elseif (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) { // empty should not happened, but when it occurs, the test save life
|
||||
if (!empty($conf->global->FAC_FORCE_DATE_VALIDATION)) { // If option enabled, we force invoice date
|
||||
$this->date = dol_now();
|
||||
$this->date_lim_reglement = $this->calculate_date_lim_reglement();
|
||||
}
|
||||
$num = $this->getNextNumRef($this->thirdparty);
|
||||
} else {
|
||||
$num = $this->ref;
|
||||
|
|
|
|||
Loading…
Reference in a new issue