From b7b799b88e1fec4bb7ccf4e8ce7c19112ad9944f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 25 Feb 2024 10:04:57 +0100 Subject: [PATCH 1/4] fix phpstan (#28403) --- htdocs/core/class/html.formsetup.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index dec81f921ec..1852fc9f878 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -249,7 +249,7 @@ class FormSetup * saveConfFromPost * * @param bool $noMessageInUpdate display event message on errors and success - * @return int -1 if KO, 1 if OK + * @return int|null Return -1 if KO, 1 if OK, null if no items */ public function saveConfFromPost($noMessageInUpdate = false) { @@ -266,7 +266,6 @@ class FormSetup return $reshook; } - if (empty($this->items)) { return null; } From 5c33a3602d0923a3d498d37913b62d289ab43467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 25 Feb 2024 10:05:11 +0100 Subject: [PATCH 2/4] fix phpstan (#28404) --- htdocs/product/stock/class/productlot.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/product/stock/class/productlot.class.php b/htdocs/product/stock/class/productlot.class.php index 70f6334972d..cd4dca967dc 100644 --- a/htdocs/product/stock/class/productlot.class.php +++ b/htdocs/product/stock/class/productlot.class.php @@ -1225,8 +1225,8 @@ class Productlot extends CommonObject $this->sellby = $now - 100000; $this->datec = $now - 3600; $this->tms = $now; - $this->fk_user_creat = null; - $this->fk_user_modif = null; + $this->fk_user_creat = 0; + $this->fk_user_modif = 0; $this->import_key = '123456'; } From b6fdae934a47f343862e5d2413772c8f07d180a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 25 Feb 2024 10:05:26 +0100 Subject: [PATCH 3/4] fix phpstan (#28405) Method DolibarrApi::_checkValForAPI() should return string but returns array. --- htdocs/api/class/api.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 8e900c27462..63d504b14cb 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -75,10 +75,10 @@ class DolibarrApi * * Display a short message an return a http code 200 * - * @param string $field Field name - * @param mixed $value Value to check/clean - * @param Object $object Object - * @return string Value cleaned + * @param string $field Field name + * @param string|array $value Value to check/clean + * @param Object $object Object + * @return string|array Value cleaned */ protected function _checkValForAPI($field, $value, $object) { From 19427168c0aa2fe67f3466ba57fcfd1f6490f9d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Sun, 25 Feb 2024 10:06:21 +0100 Subject: [PATCH 4/4] enhance warnings messages (#28409) --- htdocs/admin/modulehelp.php | 2 +- htdocs/admin/modules.php | 2 +- htdocs/admin/system/modules.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index cbf9ac6fba6..8ef166d933c 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -200,7 +200,7 @@ foreach ($modulesdir as $dir) { dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); } } else { - print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)
"; + print info_admin("Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)", 0, 0, '1', 'warning'); } } catch (Exception $e) { dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 27d0b5c0581..62c612ab24a 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -485,7 +485,7 @@ foreach ($modulesdir as $dir) { dol_syslog("Module ".get_class($objMod)." not qualified"); } } else { - print "admin/modules.php Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)
"; + print info_admin("admin/modules.php Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)", 0, 0, '1', 'warning'); } } catch (Exception $e) { dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index 4cd42fe0243..94c29927cb9 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -67,7 +67,7 @@ $arrayfields = array( $arrayfields = dol_sort_array($arrayfields, 'position'); $param = ''; - +$info_admin = ''; /* * Actions @@ -120,7 +120,7 @@ foreach ($modulesdir as $dir) { dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); } } else { - print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)
"; + $info_admin .= info_admin("Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)", 0, 0, '1', 'warning'); } } } @@ -202,7 +202,7 @@ foreach ($modules as $key => $module) { */ llxHeader(); - +print $info_admin; print '
'; if ($optioncss != '') { print '';