From b1a78c6c18829e63eeb3c1c0e9b62481c3b7c03a Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 12 Jan 2021 17:18:41 +0100 Subject: [PATCH 1/7] fix thirdparty list filter type_ent empty --- htdocs/societe/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 2e24f355b37..a4ad5ec590e 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -816,7 +816,7 @@ if (!empty($arrayfields['country.code_iso']['checked'])) if (!empty($arrayfields['typent.code']['checked'])) { print ''; - print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 'maxwidth75', 1); + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 1, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT), 'maxwidth75', 1); print ''; } // Staff From 5b21702508323dbed660fb57d320c2b3fc4fa116 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 12 Jan 2021 17:44:22 +0100 Subject: [PATCH 2/7] extrafeild selllist can be use with string fk --- htdocs/core/tpl/extrafields_list_search_sql.tpl.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index 03d487ee0c0..316899ee472 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -37,7 +37,8 @@ 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') $mode_search = 2; // Search on a foreign key int + 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')) && 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 elseif ($typ === 'select' and is_string($crit) and strpos($crit, ' ') === false) { From 34b792e9a22738a6210cfd98a89ff7c61e9e23b5 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 12 Jan 2021 21:44:18 +0100 Subject: [PATCH 3/7] betterfix --- htdocs/core/tpl/extrafields_list_search_sql.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index 316899ee472..296dfec52a0 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -37,7 +37,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 From 3ddcc0efd3ace9abda53417811554d191d1220db Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 12 Jan 2021 21:50:02 +0100 Subject: [PATCH 4/7] revert stuff from 12.0 --- htdocs/user/class/usergroup.class.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index ad26e3e9b6d..5ba6b5553af 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -660,12 +660,6 @@ 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); } From 014d3cc11416789244bda76a5253a58679814842 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 18 Jan 2021 09:08:54 +0100 Subject: [PATCH 5/7] better fix --- htdocs/core/tpl/extrafields_list_search_sql.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index c78625425fb..9bb2e5acb11 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -36,7 +36,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_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('sellist')) && !is_numeric($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 elseif ($typ === 'select' and is_string($crit) and strpos($crit, ' ') === false) { From 33a0cf078c44bbdd01f77e06f38f3fb3e256161b Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 18 Jan 2021 09:12:23 +0100 Subject: [PATCH 6/7] better fix --- htdocs/core/tpl/extrafields_list_search_sql.tpl.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index 03d487ee0c0..a74c9129cb0 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -37,7 +37,8 @@ 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') $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_numeric($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 elseif ($typ === 'select' and is_string($crit) and strpos($crit, ' ') === false) { From c4f8e81d5d56a740da9888ce7623009ea7d611c0 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Mon, 18 Jan 2021 09:18:42 +0100 Subject: [PATCH 7/7] better fix --- htdocs/core/tpl/extrafields_list_search_sql.tpl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php index a74c9129cb0..d485702ae0f 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -37,7 +37,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_numeric($crit)) $mode_search = 2; // Search on a foreign key int + if (in_array($typ, array('sellist', 'link')) && $crit != '0' && $crit != '-1') $mode_search = 2; // Search on a foreign key int if (in_array($typ, array('sellist')) && !is_numeric($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