FIX 11.0 - default filtering for extrafields of type 'select' should not use a LIKE "%value%" condition because keys might overlap

This commit is contained in:
Florian Mortgat 2020-02-05 14:57:40 +01:00
parent 1fe9783760
commit eb17a52027

View File

@ -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);
}
}