);
}
- // add group_contact table if group table is present
- if (!empty($tables['civicrm_group']) && empty($tables['civicrm_group_contact'])) {
- $tables['civicrm_group_contact'] = " LEFT JOIN civicrm_group_contact ON civicrm_group_contact.contact_id = contact_a.id AND civicrm_group_contact.status = 'Added'";
+ // add group_contact and group_contact_cache table if group table is present
+ if (!empty($tables['civicrm_group'])) {
+ if (empty($tables['civicrm_group_contact'])) {
+ $tables['civicrm_group_contact'] = " LEFT JOIN civicrm_group_contact ON civicrm_group_contact.contact_id = contact_a.id AND civicrm_group_contact.status = 'Added' ";
+ }
+ if (empty($tables['civicrm_group_contact_cache'])) {
+ $tables['civicrm_group_contact_cache'] = " LEFT JOIN civicrm_group_contact_cache ON civicrm_group_contact_cache.contact_id = contact_a.id ";
+ }
}
// add group_contact and group table is subscription history is present
continue;
case 'civicrm_group':
- $from .= " $side JOIN civicrm_group ON civicrm_group.id = civicrm_group_contact.group_id ";
+ $from .= " $side JOIN civicrm_group ON (civicrm_group.id = civicrm_group_contact.group_id OR civicrm_group.id = civicrm_group_contact_cache.group_id) ";
continue;
case 'civicrm_group_contact':
$from .= " $side JOIN civicrm_group_contact ON contact_a.id = civicrm_group_contact.contact_id ";
continue;
+ case 'civicrm_group_contact_cache':
+ $from .= " $side JOIN civicrm_group_contact_cache ON contact_a.id = civicrm_group_contact_cache.contact_id ";
+ continue;
+
case 'civicrm_activity':
case 'civicrm_activity_tag':
case 'activity_type':
list($qillop, $qillVal) = CRM_Contact_BAO_Query::buildQillForFieldValue('CRM_Contact_DAO_Group', 'id', $value, $op);
$this->_qill[$grouping][] = ts("Group(s) %1 %2", array(1 => $qillop, 2 => $qillVal));
- $this->_qill[$grouping][] = ts("Group Status %1", array(1 => implode(' ' . ts('or') . ' ', $statii)));
+ if (strpos($op, 'NULL') === FALSE) {
+ $this->_qill[$grouping][] = ts("Group Status %1", array(1 => implode(' ' . ts('or') . ' ', $statii)));
+ }
if ($groupClause) {
$this->_where[$grouping][] = $groupClause;
}
'civicrm_openid' => '17',
'civicrm_location_type' => '18',
'civicrm_group_contact' => '19',
- 'civicrm_group' => '20',
- 'civicrm_subscription_history' => '21',
- 'civicrm_entity_tag' => '22',
- 'civicrm_note' => '23',
- 'civicrm_contribution' => '24',
- 'civicrm_financial_type' => '25',
- 'civicrm_participant' => '26',
- 'civicrm_event' => '27',
- 'civicrm_worldregion' => '28',
- 'civicrm_case_contact' => '29',
- 'civicrm_case' => '30',
- 'case_relationship' => '31',
- 'case_relation_type' => '32',
- 'civicrm_activity' => '33',
- 'civicrm_mailing_summary' => '34',
- 'civicrm_mailing_recipients' => '35',
- 'civicrm_mailing' => '36',
- 'civicrm_mailing_job' => '37',
- 'civicrm_mailing_event_queue' => '38',
- 'civicrm_mailing_event_bounce' => '39',
- 'civicrm_mailing_event_opened' => '40',
- 'civicrm_mailing_event_reply' => '41',
- 'civicrm_mailing_event_trackable_url_open' => '42',
+ 'civicrm_group_contact_cache' => '20',
+ 'civicrm_group' => '21',
+ 'civicrm_subscription_history' => '22',
+ 'civicrm_entity_tag' => '23',
+ 'civicrm_note' => '24',
+ 'civicrm_contribution' => '25',
+ 'civicrm_financial_type' => '26',
+ 'civicrm_participant' => '27',
+ 'civicrm_event' => '28',
+ 'civicrm_worldregion' => '29',
+ 'civicrm_case_contact' => '30',
+ 'civicrm_case' => '31',
+ 'case_relationship' => '32',
+ 'case_relation_type' => '33',
+ 'civicrm_activity' => '34',
+ 'civicrm_mailing_summary' => '35',
+ 'civicrm_mailing_recipients' => '36',
+ 'civicrm_mailing' => '37',
+ 'civicrm_mailing_job' => '38',
+ 'civicrm_mailing_event_queue' => '39',
+ 'civicrm_mailing_event_bounce' => '40',
+ 'civicrm_mailing_event_opened' => '41',
+ 'civicrm_mailing_event_reply' => '42',
+ 'civicrm_mailing_event_trackable_url_open' => '43',
);
/**