2
0
forked from Wavyzz/dolibarr

NEW Exclude filter

This commit is contained in:
Quentin VIAL-GOUTEYRON
2022-01-31 16:09:31 +01:00
parent 3b8ece6c0b
commit e086d5a5f2

View File

@@ -9148,7 +9148,15 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0)
if (preg_match('/\.(id|rowid)$/', $field)) { // Special case for rowid that is sometimes a ref so used as a search field
$newres .= $field." = ".(is_numeric(trim($tmpcrit)) ? ((float) trim($tmpcrit)) : '0');
} else {
$newres .= $field." LIKE '";
$tmpcrit = trim($tmpcrit);
$tmpcrit2 = $tmpcrit;
$tmpbefore = '%';
$tmpafter = '%';
if(preg_match('/^!/', $tmpcrit)) {
$newres .= $field." NOT LIKE '"; // ! as exclude character
$tmpcrit2 = preg_replace('/^!/', '', $tmpcrit2);
}
else $newres .= $field." LIKE '";
$tmpcrit = trim($tmpcrit);
$tmpcrit2 = $tmpcrit;