Merge branch 'ent-12871-16045-16060-Busquedas-eventos-con-2-espacios-no-muestra-resultados' into 'develop'
search collapsing whitespaces See merge request artica/pandorafms!6936
This commit is contained in:
commit
8d3a7e6a7f
|
@ -1177,14 +1177,18 @@ function events_get_all(
|
|||
$array_search[] = 'lower(ta.alias)';
|
||||
}
|
||||
|
||||
// Disregard repeated whitespaces in search string.
|
||||
$collapsed_spaces_search = preg_replace('/( )+/', ' ', $filter['search']);
|
||||
|
||||
$sql_search = ' AND (';
|
||||
foreach ($array_search as $key => $field) {
|
||||
// Disregard repeated whitespaces in query searched string.
|
||||
$sql_search .= sprintf(
|
||||
'%s %s %s like lower("%%%s%%")',
|
||||
'%s REGEXP_REPLACE(%s, "( \\s*)+", " ") %s like lower("%%%s%%")',
|
||||
($key === 0) ? '' : $nexo,
|
||||
$field,
|
||||
$not_search,
|
||||
$filter['search']
|
||||
$collapsed_spaces_search
|
||||
);
|
||||
$sql_search .= ' ';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue