daily group membership trigger doesn't include smart groups
The daily group membership trigger is really useful, but doesn't currently support smart groups. I have a solution in place for our client, but want to run it by you before I file a PR.
In CivirulesCronTrigger/GroupMembership.php, queryForTriggerEntitites(), we have a query to retrieve the contacts from civicrm_group_contact. I've done the following:
- prior to that query, call CRM_Contact_BAO_GroupContactCache::loadAll($this->triggerParams['group_id']). this rebuilds the cache for any smart groups
- add a UNION query with civicrm_group_contact_cache, similar to the existing query. this results in a single query with no duplicates
Let me know if you agree with the approach and I'll work on a PR.