Commit dd606225 authored by jitendra's avatar jitendra

#1685 - Search builder returns DB error on Group => Empty condition

parent 01c2b2e1
......@@ -2990,8 +2990,8 @@ class CRM_Contact_BAO_Query {
// even one group might equate to multiple when looking at children so IN is simpler.
// @todo - also look at != casting but there are rows below to review.
$opReplacements = [
'EMPTY' => 'NULL',
'NOT EMPTY' => 'NOT NULL',
'IS EMPTY' => 'IS NULL',
'IS NOT EMPTY' => 'IS NOT NULL',
'=' => 'IN',
];
if (isset($opReplacements[$op])) {
......
......@@ -862,6 +862,10 @@ civicrm_relationship.is_active = 1 AND
$queryObj = new CRM_Contact_BAO_Query([['group', '=', $groupID, 0, 0], ['group_contact_status', 'IN', ['Removed' => 1], 0, 0]]);
$resultDAO = $queryObj->searchQuery();
$this->assertEquals(1, $resultDAO->N);
$queryObj = new CRM_Contact_BAO_Query([['group', 'IS NOT EMPTY', '', 0, 0], ['group_contact_status', 'IN', ['Removed' => 1], 0, 0]]);
$resultDAO = $queryObj->searchQuery();
$this->assertEquals(1, $resultDAO->N);
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment