FIX: Fix natural search with negative numbers (#34322)

This commit is contained in:
kkhelifa-opendsi
2025-06-04 11:20:03 +02:00
committed by GitHub
parent 81bdb3ae98
commit 6059b0e6f5

View File

@@ -12296,7 +12296,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
}
$i2++; // a criteria for 1 more field was added to string
} elseif ($mode == 2 || $mode == -2) {
$crit = preg_replace('/[^0-9,]/', '', $crit); // ID are always integer
$crit = preg_replace('/[^\-0-9,]/', '', $crit); // ID are always integer
$newres .= ($i2 > 0 ? ' OR ' : '').$db->sanitize($field)." ".($mode == -2 ? 'NOT ' : '');
$newres .= $crit ? "IN (".$db->sanitize($db->escape($crit)).")" : "IN (0)";
if ($mode == -2) {