diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index d8755b87433..9aa6c74e744 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -953,7 +953,7 @@ while ($i < min($num, $limit)) { if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; } if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; } if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; } - if (!empty($arrayfields['t.date_validating']['checked'])) { $colspanend++; } + if (!empty($arrayfields['t.date_validated']['checked'])) { $colspanend++; } if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; } if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { $colspan++; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 2ccb6828f16..e9be3761efa 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -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]) { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d9e9bef3f73..869af987017 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -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; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 466469423d8..b3852a562fb 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -585,7 +585,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it } // Run complementary sql requests - $num = count($array_sql); + $num = count((array) $array_sql); for ($i = 0; $i < $num; $i++) { if (!$err) { dol_syslog(get_class($this)."::_remove", LOG_DEBUG); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index e4af56a639c..8123f89c2b1 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1142,6 +1142,9 @@ class User extends CommonObject } $sql .= " AND ur.fk_user= ".((int) $this->id); $sql .= " AND r.perms IS NOT NULL"; + if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) { + $sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled + } if ($moduletag) { $sql .= " AND r.module = '".$this->db->escape($moduletag)."'"; }