2
0
forked from Wavyzz/dolibarr

FIX avoid the return "AND (())" (#30829)

This commit is contained in:
Regis Houssin
2024-09-04 23:05:51 +02:00
committed by GitHub
parent 48ce67a9be
commit 6bb818e7fc

View File

@@ -12546,6 +12546,10 @@ function jsonOrUnserialize($stringtodecode)
*/
function forgeSQLFromUniversalSearchCriteria($filter, &$errorstr = '', $noand = 0, $nopar = 0, $noerror = 0)
{
if (empty($filter)) {
return ''; // to avoid the return "AND (())"
}
if (!preg_match('/^\(.*\)$/', $filter)) { // If $filter does not start and end with ()
$filter = '(' . $filter . ')';
}