From 116ff4a985a088e43fe75855adf44408987fe807 Mon Sep 17 00:00:00 2001 From: Kamel Khelifa Date: Mon, 27 Nov 2023 16:54:52 +0100 Subject: [PATCH 1/3] FIX: Fix when options FAC_FORCE_DATE_VALIDATION and INVOICE_CHECK_POSTERIOR_DATE enabled. The date is forced after the test and not before --- htdocs/compta/facture/card.php | 6 ++++++ htdocs/compta/facture/class/facture.class.php | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) 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; From 9d67ca34d3c1ff6fd09a94d638f0afa1dfac1dd7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Nov 2023 21:19:15 +0100 Subject: [PATCH 2/3] Fix count on nb of permission --- htdocs/user/class/user.class.php | 3 +++ 1 file changed, 3 insertions(+) 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)."'"; } From ccfb5e2730d22eb29368eae348277913ae1716dc Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 28 Nov 2023 09:18:16 +0100 Subject: [PATCH 3/3] Debug v18 (#26877) * Fix column name - Colspan problem * Update DolibarrModules.class.php --- htdocs/accountancy/bookkeeping/listbyaccount.php | 2 +- htdocs/core/modules/DolibarrModules.class.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/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);