I've made this patch the least possible code wise to allow brain space to think about the query....
Basically the where is WHERE acl.entity_table='civicrm_acl_role'....
if contact_id is set it becomes AND acl.entity_table = 'civicrm_contact'
Which means that it would only ever return empty results
(once this is merged more cleanup can happen but I wanted to
make this change easy to think through)
$where = ['acl.entity_table = "civicrm_acl_role" AND acl.entity_id IN (' . implode(',', array_keys(CRM_Core_OptionGroup::values('acl_role'))) . ')'];
if (!empty($contact_id)) {
- $where[] = " acl.entity_table = 'civicrm_contact' AND acl.is_active = 1 AND acl.entity_id = $contact_id";
+ return [];
}
$results = [];