From eb17a5202757d91d018b346bc6fe8b5d40c39dd6 Mon Sep 17 00:00:00 2001 From: Florian Mortgat Date: Wed, 5 Feb 2020 14:57:40 +0100 Subject: [PATCH] FIX 11.0 - default filtering for extrafields of type 'select' should not use a LIKE "%value%" condition because keys might overlap --- htdocs/core/tpl/extrafields_list_search_sql.tpl.php | 5 ++++- 1 file changed, 4 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 29c67094975..3a0bcf6375c 100644 --- a/htdocs/core/tpl/extrafields_list_search_sql.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_sql.tpl.php @@ -40,7 +40,10 @@ if (! empty($extrafieldsobjectkey) && ! empty($search_array_options) && is_array 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('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) { + $sql .= ' AND (' . $extrafieldsobjectprefix.$tmpkey . ' = "' . $db->escape($crit) . '")'; + continue; + } $sql .= natural_search($extrafieldsobjectprefix.$tmpkey, $crit, $mode_search); } }