Skip to content
Snippets Groups Projects
Commit 5bf8e8fa authored by mattwire's avatar mattwire
Browse files

Also check smartgroups for 'Contact in group' condition

parent f6a64b2d
No related branches found
No related tags found
Loading
......@@ -31,7 +31,22 @@ class CRM_CivirulesConditions_Utils_GroupContact {
if ($groupContactCount > 0) {
return TRUE;
}
// @fixme We really need a "is in smartgroup" API!!
// If the groups are smartgroups (saved searches) they may be out of date.
// This triggers a check (and rebuild if necessary).
\CRM_Contact_BAO_GroupContactCache::check($group_id);
$query = "SELECT id FROM `civicrm_group_contact_cache` WHERE group_id=%1 AND contact_id=%2";
$queryParams = [
1 => [$group_id, 'Positive'],
2 => [$contact_id, 'Positive'],
];
if (CRM_Core_DAO::singleValueQuery($query, $queryParams, FALSE)) {
return TRUE;
}
return FALSE;
}
}
\ No newline at end of file
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment