diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index fa6d7bee21b..52695e99c28 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -9151,12 +9151,11 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) $tmpcrit = trim($tmpcrit); $tmpcrit2 = $tmpcrit; $tmpbefore = '%'; - $tmpafter = '%'; - if(preg_match('/^!/', $tmpcrit)) { + $tmpafter = '%'; + if (preg_match('/^!/', $tmpcrit)) { $newres .= $field." NOT LIKE '"; // ! as exclude character $tmpcrit2 = preg_replace('/^!/', '', $tmpcrit2); - } - else $newres .= $field." LIKE '"; + } else $newres .= $field." LIKE '"; if (preg_match('/^[\^\$]/', $tmpcrit)) { $tmpbefore = '';