FIX Missing quotes when using __NOW__
This commit is contained in:
parent
80adcffa4f
commit
a3470bbd06
1 changed files with 4 additions and 2 deletions
|
|
@ -13975,7 +13975,7 @@ function forgeSQLFromUniversalSearchCriteria($filter, &$errorstr = '', $noand =
|
|||
$ret = ($noand ? "" : " AND ").($nopar ? "" : '(').preg_replace_callback('/'.$regexstring.'/i', 'dolForgeSQLCriteriaCallback', $filter).($nopar ? "" : ')');
|
||||
|
||||
if (is_object($db)) {
|
||||
$ret = str_replace('__NOW__', $db->idate(dol_now()), $ret);
|
||||
$ret = str_replace('__NOW__', "'".$db->idate(dol_now())."'", $ret);
|
||||
}
|
||||
if (is_object($user)) {
|
||||
$ret = str_replace('__USER_ID__', (string) $user->id, $ret);
|
||||
|
|
@ -14206,8 +14206,10 @@ function dolForgeSQLCriteriaCallback($matches)
|
|||
$tmpescaped = 'NULL';
|
||||
} elseif (ctype_digit((string) $tmpescaped)) { // if only 0-9 chars, no .
|
||||
$tmpescaped = (int) $tmpescaped;
|
||||
} else {
|
||||
} elseif (is_numeric((string) $tmpescaped)) { // it can be a float with a .
|
||||
$tmpescaped = (float) $tmpescaped;
|
||||
} else {
|
||||
$tmpescaped = preg_replace('/[^a-z0-9_]/i', '', $tmpescaped); // it can be a name of field or a substitution variable like '__NOW__'
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue