Skip to content

Commit

Permalink
FIX avoid the return "AND (())" (#30829)
Browse files Browse the repository at this point in the history
  • Loading branch information
hregis authored Sep 4, 2024
1 parent 48ce67a commit 6bb818e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions htdocs/core/lib/functions.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 . ')';
}
Expand Down

0 comments on commit 6bb818e

Please sign in to comment.