diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index ca703979a7d..2ca0bf6b439 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1597,7 +1597,7 @@ class ExtraFields if (!empty($extrafieldsobjectkey)) { $label = $this->attributes[$extrafieldsobjectkey]['label'][$key]; $type = $this->attributes[$extrafieldsobjectkey]['type'][$key]; - $size = $this->attributes[$extrafieldsobjectkey]['size'][$key]; + $size = (int) $this->attributes[$extrafieldsobjectkey]['size'][$key]; $default = $this->attributes[$extrafieldsobjectkey]['default'][$key]; $computed = $this->attributes[$extrafieldsobjectkey]['computed'][$key]; $unique = $this->attributes[$extrafieldsobjectkey]['unique'][$key]; @@ -1666,7 +1666,7 @@ class ExtraFields $value = price($value, 0, $langs, 0, 0, -1); } } elseif ($type == 'select') { - $valstr = $param['options'][$value]; + $valstr = (!empty($param['options'][$value]) ? $param['options'][$value] : ''); if (($pos = strpos($valstr, "|")) !== false) { $valstr = substr($valstr, 0, $pos); } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8b0b482f33f..b18ed68eaa2 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6684,7 +6684,7 @@ class Form if (!dol_eval($val['enabled'], 1, 1)) { continue; } - if ($val['showoncombobox']) { + if (!empty($val['showoncombobox'])) { $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key; } } @@ -6817,7 +6817,7 @@ class Form if (!$forcecombo) { include_once DOL_DOCUMENT_ROOT.'/core/lib/ajax.lib.php'; - $out .= ajax_combobox($htmlname, null, $conf->global->$confkeyforautocompletemode); + $out .= ajax_combobox($htmlname, null, (!empty($conf->global->$confkeyforautocompletemode) ? $conf->global->$confkeyforautocompletemode : 0)); } } else { dol_print_error($this->db); diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index 5ea0e4821d6..4c56b0223cd 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -35,7 +35,7 @@ if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table } $value = $datenotinstring; } else { - $value = $obj->$tmpkey; + $value = (!empty($obj->$tmpkey) ? $obj->$tmpkey : ''); } // If field is a computed field, we make computation to get value if ($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key]) { diff --git a/htdocs/core/tpl/extrafields_list_search_input.tpl.php b/htdocs/core/tpl/extrafields_list_search_input.tpl.php index 77329eb06a4..72f888f256a 100644 --- a/htdocs/core/tpl/extrafields_list_search_input.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_input.tpl.php @@ -37,17 +37,17 @@ if (!empty($extrafieldsobjectkey)) { // $extrafieldsobject is the $object->table if (in_array($typeofextrafield, array('int', 'double'))) { $searchclass = 'searchnum'; } - print ''; + print ''; } elseif (in_array($typeofextrafield, array('datetime', 'timestamp'))) { $morecss = ''; - echo $extrafields->showInputField($key, $search_array_options[$search_options_pattern.$tmpkey], '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1); + echo $extrafields->showInputField($key, (empty($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]), '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1); } else { // for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid') $morecss = ''; if (in_array($typeofextrafield, array('link', 'sellist', 'text', 'html'))) { $morecss = 'maxwidth200'; } - echo $extrafields->showInputField($key, $search_array_options[$search_options_pattern.$tmpkey], '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1); + echo $extrafields->showInputField($key, (empty($search_array_options[$search_options_pattern.$tmpkey]) ? '' : $search_array_options[$search_options_pattern.$tmpkey]), '', '', $search_options_pattern, $morecss, 0, $extrafieldsobjectkey, 1); } print ''; }