diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index d2e38b289f6..c78625425fb 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -35,7 +35,7 @@ if (!empty($extrafieldsobjectkey) && !empty($search_array_options) && is_array($ { $mode_search = 0; if (in_array($typ, array('int', 'double', 'real', 'price'))) $mode_search = 1; // Search on a numeric - if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1' && !is_string($crit)) $mode_search = 2; // Search on a foreign key int + if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1' && is_numeric($crit)) $mode_search = 2; // Search on a foreign key int if (in_array($typ, array('sellist')) && is_string($crit)) $mode_search = 0;// Search on a foreign key string if (in_array($typ, array('chkbxlst', 'checkbox'))) $mode_search = 4; // Search on a multiselect field with sql type = text if (is_array($crit)) $crit = implode(' ', $crit); // natural_search() expects a string diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 5ba6b5553af..ad26e3e9b6d 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -660,6 +660,12 @@ class UserGroup extends CommonObject $this->nom = $this->name; // Field for 'name' is called 'nom' in database } + $entity = $conf->entity; + if (!empty($conf->multicompany->enabled) && $conf->entity == 1) + { + $entity = $this->entity; + } + return $this->updateCommon($user, $notrigger); }