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. }