diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 9311adb11ef..bb69fd4966d 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9768,7 +9768,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) $value = preg_replace('/\*/', '%', $value); // Replace * with % } if ($mode == 1) { - $value = preg_replace('/([<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"), '/').'\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do + $value = preg_replace('/([!<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"), '/').'\-])/', '\1\2', $value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do } $value = preg_replace('/\s*\|\s*/', '|', $value); @@ -9788,10 +9788,10 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) foreach ($fields as $field) { if ($mode == 1) { $operator = '='; - $newcrit = preg_replace('/([<>=]+)/', '', $crit); + $newcrit = preg_replace('/([!<>=]+)/', '', $crit); $reg = array(); - preg_match('/([<>=]+)/', $crit, $reg); + preg_match('/([!<>=]+)/', $crit, $reg); if (!empty($reg[1])) { $operator = $reg[1]; }