diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index f7cfbc1f24a..22b65d688fd 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -829,11 +829,11 @@ class ExtraFields * @param string $moreparam To add more parametes on html input tag * @param string $keysuffix Prefix string to add after name and id of field (can be used to avoid duplicate names) * @param string $keyprefix Suffix string to add before name and id of field (can be used to avoid duplicate names) - * @param mixed $showsize Value for css to define size. May also be a numeric. + * @param string $morecss More css (to defined size of field. Old behaviour: may also be a numeric) * @param int $objectid Current object id * @return string */ - function showInputField($key, $value, $moreparam='', $keysuffix='', $keyprefix='', $showsize=0, $objectid=0) + function showInputField($key, $value, $moreparam='', $keysuffix='', $keyprefix='', $morecss='', $objectid=0) { global $conf,$langs,$form; @@ -866,45 +866,41 @@ class ExtraFields else return ''; } - if (empty($showsize)) + if (empty($morecss)) { if ($type == 'date') { - //$showsize=10; - $showsize = 'minwidth100imp'; + $morecss = 'minwidth100imp'; } elseif ($type == 'datetime') { - //$showsize=19; - $showsize = 'minwidth200imp'; + $morecss = 'minwidth200imp'; } elseif (in_array($type,array('int','integer','double','price'))) { - //$showsize=10; - $showsize = 'maxwidth75'; + $morecss = 'maxwidth75'; } elseif ($type == 'url') { - $showsize='minwidth400'; + $morecss='minwidth400'; } elseif ($type == 'boolean') { - $showsize=''; + $morecss=''; } else { if (round($size) < 12) { - $showsize = 'minwidth100'; + $morecss = 'minwidth100'; } else if (round($size) <= 48) { - $showsize = 'minwidth200'; + $morecss = 'minwidth200'; } else { - //$showsize=48; - $showsize = 'minwidth400'; + $morecss = 'minwidth400'; } } } @@ -926,15 +922,15 @@ class ExtraFields { $tmp=explode(',',$size); $newsize=$tmp[0]; - $out=''; + $out=''; } elseif (preg_match('/varchar/', $type)) { - $out=''; + $out=''; } elseif (in_array($type, array('mail', 'phone', 'url'))) { - $out=''; + $out=''; } elseif ($type == 'text') { @@ -946,7 +942,7 @@ class ExtraFields } else { - $out=''; + $out=''; } } elseif ($type == 'boolean') @@ -957,21 +953,21 @@ class ExtraFields } else { $checked=' value="1" '; } - $out=''; + $out=''; } elseif ($type == 'price') { if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. $value=price($value); } - $out=' '.$langs->getCurrencySymbol($conf->currency); + $out=' '.$langs->getCurrencySymbol($conf->currency); } elseif ($type == 'double') { if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. $value=price($value); } - $out=' '; + $out=' '; } elseif ($type == 'select') { @@ -982,7 +978,7 @@ class ExtraFields $out.= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0); } - $out.=''; $out.=''; foreach ($param['options'] as $key => $val) { @@ -1004,7 +1000,7 @@ class ExtraFields $out.= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0); } - $out.=''; if (is_array($param['options'])) { $param_list=array_keys($param['options']); @@ -1173,7 +1169,7 @@ class ExtraFields $out=''; foreach ($param['options'] as $keyopt => $val) { - $out.=''; + $out=''; } if (!empty($hidden)) { $out=''; diff --git a/htdocs/core/tpl/extrafields_list_search_input.tpl.php b/htdocs/core/tpl/extrafields_list_search_input.tpl.php index c3e3effc05d..42770fc91f5 100644 --- a/htdocs/core/tpl/extrafields_list_search_input.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_input.tpl.php @@ -28,7 +28,9 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab elseif (! in_array($typeofextrafield, array('datetime','timestamp'))) { // 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') - echo $extrafields->showInputField($key, $search_array_options['search_options_'.$key], '', '', 'search_'); + $morecss=''; + if ($typeofextrafield == 'sellist') $morecss='maxwidth200'; + echo $extrafields->showInputField($key, $search_array_options['search_options_'.$key], '', '', 'search_', $morecss); } elseif (in_array($typeofextrafield, array('datetime','timestamp'))) {