forked from Wavyzz/dolibarr
FIX Accept spaces around the | criteria
This commit is contained in:
@@ -5677,7 +5677,7 @@ function dol_getmypid()
|
|||||||
* If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < 1000"
|
* If param $mode is 1, can contains an operator <, > or = like "<10" or ">=100.5 < 1000"
|
||||||
* If param $mode is 2, can contains a list of id separated by comma like "1,3,4"
|
* If param $mode is 2, can contains a list of id separated by comma like "1,3,4"
|
||||||
* @param integer $mode 0=value is list of keywords, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of id separated with comma (Example '1,3,4')
|
* @param integer $mode 0=value is list of keywords, 1=value is a numeric test (Example ">5.5 <10"), 2=value is a list of id separated with comma (Example '1,3,4')
|
||||||
* @param integer $nofirstand 1=Do now output the first 'AND'
|
* @param integer $nofirstand 1=Do not output the first 'AND'
|
||||||
* @return string $res The statement to append to the SQL query
|
* @return string $res The statement to append to the SQL query
|
||||||
*/
|
*/
|
||||||
function natural_search($fields, $value, $mode=0, $nofirstand=0)
|
function natural_search($fields, $value, $mode=0, $nofirstand=0)
|
||||||
@@ -5692,6 +5692,9 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
|
|||||||
{
|
{
|
||||||
$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);
|
||||||
|
|
||||||
$crits = explode(' ', $value);
|
$crits = explode(' ', $value);
|
||||||
$res = '';
|
$res = '';
|
||||||
if (! is_array($fields)) $fields = array($fields);
|
if (! is_array($fields)) $fields = array($fields);
|
||||||
|
|||||||
Reference in New Issue
Block a user