2
0
forked from Wavyzz/dolibarr

Debug blockedlog for loi finance 2016

This commit is contained in:
Laurent Destailleur
2018-01-05 04:31:48 +01:00
parent 1e438b7ebd
commit dbf7603118
11 changed files with 330 additions and 181 deletions

View File

@@ -6589,6 +6589,7 @@ function dol_getmypid()
* or like "keyword1|keyword2" = We want record field like keyword1 OR field like keyword2
* 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 int id separated by comma like "1,3,4"
* If param $mode is 3, can contains a list of string separated by comma like "a,b,c"
* @param integer $mode 0=value is list of keyword strings, 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 not output the first 'AND'
* @return string $res The statement to append to the SQL query
@@ -6652,6 +6653,24 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
$newres .= ($i2 > 0 ? ' OR ' : '') . $field . " IN (" . $db->escape(trim($crit)) . ")";
$i2++; // a criteria was added to string
}
else if ($mode == 3)
{
$tmparray=explode(',',trim($crit));
if (count($tmparray))
{
$listofcodes='';
foreach($tmparray as $val)
{
if ($val)
{
$listofcodes.=($listofcodes?',':'');
$listofcodes.="'".$db->escape(trim($val))."'";
}
}
$newres .= ($i2 > 0 ? ' OR ' : '') . $field . " IN (" . $listofcodes . ")";
$i2++; // a criteria was added to string
}
}
else // $mode=0
{
$textcrit = '';
@@ -6661,7 +6680,7 @@ function natural_search($fields, $value, $mode=0, $nofirstand=0)
{
$newres .= (($i2 > 0 || $i3 > 0) ? ' OR ' : '');
if (preg_match('/\.(id|rowid)$/', $field)) // Special cas for rowid that is sometimes a ref so used as a search field
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))?trim($tmpcrit):'0');
}