From bc0b5a876ff03c25394c0ae9680e1d9ec111bfb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 1 Aug 2024 12:41:44 +0200 Subject: [PATCH 1/2] fix travis test (#30517) --- htdocs/admin/mails_passwordreset.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/mails_passwordreset.php b/htdocs/admin/mails_passwordreset.php index 27754f5845b..21b37366b0a 100644 --- a/htdocs/admin/mails_passwordreset.php +++ b/htdocs/admin/mails_passwordreset.php @@ -84,7 +84,7 @@ if ($action == 'update' && !$cancel) { dolibarr_set_const($db, "MAIN_MAIL_SMTP_SERVER_PASSWORDRESET", GETPOST("MAIN_MAIL_SMTP_SERVER_PASSWORDRESET"), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MAIL_SMTPS_ID_PASSWORDRESET", GETPOST("MAIN_MAIL_SMTPS_ID_PASSWORDRESET"), 'chaine', 0, '', $conf->entity); if (GETPOSTISSET("MAIN_MAIL_SMTPS_PW_PASSWORDRESET")) { - dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW_PASSWORDRESET", GETPOST("MAIN_MAIL_SMTPS_PW_PASSWORDRESET", 'none'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_MAIL_SMTPS_PW_PASSWORDRESET", GETPOST("MAIN_MAIL_SMTPS_PW_PASSWORDRESET", 'password'), 'chaine', 0, '', $conf->entity); } if (GETPOSTISSET("MAIN_MAIL_SMTPS_AUTH_TYPE_PASSWORDRESET")) { dolibarr_set_const($db, "MAIN_MAIL_SMTPS_AUTH_TYPE_PASSWORDRESET", GETPOST("MAIN_MAIL_SMTPS_AUTH_TYPE_PASSWORDRESET", 'alphanohtml'), 'chaine', 0, '', $conf->entity); From 75a4a3184194bb126191fd2abd6a41132d076854 Mon Sep 17 00:00:00 2001 From: MDW Date: Thu, 1 Aug 2024 12:49:01 +0200 Subject: [PATCH 2/2] Qual: CommonObject improvements (Phan notices) (#30507) Improve phpdoc, initialisation, field test --- htdocs/core/class/commonobject.class.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 06a5b21afbc..b4e028b2a5c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -145,7 +145,8 @@ abstract class CommonObject /** * @var array> Array to store alternative languages values of object - * Note: call fetchValuesForExtraLanguages() before using this + * + * Note: call fetchValuesForExtraLanguages() before using this */ public $array_languages = null; // Value is array() when load already tried @@ -3356,9 +3357,9 @@ abstract class CommonObject /** * Get children of line * - * @param int $id Id of parent line - * @param int $includealltree 0 = 1st level child, >0 = All level child - * @return int[] Array with list of children lines id + * @param int $id Id of parent line + * @param int<0,1> $includealltree 0 = 1st level child, 1 = All level child + * @return int[] Array with list of children lines id */ public function getChildrenOfLine($id, $includealltree = 0) { @@ -8092,6 +8093,7 @@ abstract class CommonObject $type = empty($val['type']) ? '' : $val['type']; $size = empty($val['css']) ? '' : $val['css']; $reg = array(); + $value = ''; // Default return value // Convert var to be able to share same code than showOutputField of extrafields if (preg_match('/varchar\((\d+)\)/', $type, $reg)) { @@ -8593,7 +8595,7 @@ abstract class CommonObject $this->clearFieldError($fieldKey); - if (!isset($fields[$fieldKey])) { + if (!isset($fields[$fieldKey]) || $fields[$fieldKey] === null) { $this->setFieldError($fieldKey, $langs->trans('FieldNotFoundInObject')); return false; } @@ -8915,7 +8917,7 @@ abstract class CommonObject $value = $getposttemp; } } elseif (in_array($extrafields->attributes[$this->table_element]['type'][$key], array('int'))) { - $value =( !empty($this->array_options["options_".$key]) || $this->array_options["options_".$key] === '0' ) ? $this->array_options["options_".$key] : ''; + $value = (!empty($this->array_options["options_".$key]) || $this->array_options["options_".$key] === '0') ? $this->array_options["options_".$key] : ''; } else { $value = (!empty($this->array_options["options_".$key]) ? $this->array_options["options_".$key] : ''); // No GET, no POST, no default value, so we take value of object. }