You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CRM-17123 remove damaging OR from smart group query
Please add review comments to civicrm#8645
Note that in testing this I checked
1) searching in search builder with groups as a criteria
(checked that correct groups show & only 'Added' ones)
2) Exporting - groups show per above when selected as an export field
3) Groups tab on a contact correctly shows added & removed groups
4) Api calls per tests
5) Manage groups - clicking through shows correct status for all members and it is possible to alter the group criteria to include 'Removed' and they show with the correct status
Change-Id: I1304eaced73262f66030010bfcce05bc7d70d0b5
// if note field is subject then return subject else body of the note
@@ -1367,6 +1381,7 @@ public function query($count = FALSE, $sortByChar = FALSE, $groupContacts = FALS
1367
1381
$this->_paramLookup['group'][0][1] = key($value);
1368
1382
}
1369
1383
1384
+
// Presumably the lines below come into manage groups screen.
1370
1385
// make sure there is only one element
1371
1386
// this is used when we are running under smog and need to know
1372
1387
// how the contact was added (CRM-1203)
@@ -2511,16 +2526,6 @@ public static function fromClause(&$tables, $inner = NULL, $right = NULL, $prima
2511
2526
);
2512
2527
}
2513
2528
2514
-
// add group_contact and group_contact_cache table if group table is present
2515
-
if (!empty($tables['civicrm_group'])) {
2516
-
if (empty($tables['civicrm_group_contact'])) {
2517
-
$tables['civicrm_group_contact'] = " LEFT JOIN civicrm_group_contact ON civicrm_group_contact.contact_id = contact_a.id AND civicrm_group_contact.status = 'Added' ";
2518
-
}
2519
-
if (empty($tables['civicrm_group_contact_cache'])) {
2520
-
$tables['civicrm_group_contact_cache'] = " LEFT JOIN civicrm_group_contact_cache ON civicrm_group_contact_cache.contact_id = contact_a.id ";
2521
-
}
2522
-
}
2523
-
2524
2529
// add group_contact and group table is subscription history is present
2525
2530
if (!empty($tables['civicrm_subscription_history']) && empty($tables['civicrm_group'])) {
2526
2531
$tables = array_merge(array(
@@ -2635,7 +2640,7 @@ public static function fromClause(&$tables, $inner = NULL, $right = NULL, $prima
2635
2640
continue;
2636
2641
2637
2642
case'civicrm_group':
2638
-
$from .= "$side JOIN civicrm_group ON (civicrm_group.id = civicrm_group_contact.group_id OR civicrm_group.id = civicrm_group_contact_cache.group_id)";
2643
+
$from .= "$side JOIN civicrm_group ON civicrm_group.id = civicrm_group_contact.group_id ";
2639
2644
continue;
2640
2645
2641
2646
case'civicrm_group_contact':
@@ -2875,11 +2880,11 @@ public function includeContactSubTypes($value, $grouping, $op = 'LIKE') {
0 commit comments