X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContact%2FBAO%2FGroupContact.php;h=8a4bb40b9e98b669c862d26caa0e2ea13fc9b118;hb=66efdbfea116d74a20496139dd284925a6ceb9cf;hp=873854707614cfda6d8def16a2090bb1e3f92140;hpb=6fd0519667b8c37759460c6c1516a22210418aa5;p=civicrm-core.git diff --git a/CRM/Contact/BAO/GroupContact.php b/CRM/Contact/BAO/GroupContact.php index 8738547076..8a4bb40b9e 100644 --- a/CRM/Contact/BAO/GroupContact.php +++ b/CRM/Contact/BAO/GroupContact.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 4.6 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2014 | + | Copyright CiviCRM LLC (c) 2004-2015 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -28,7 +28,7 @@ /** * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2014 + * @copyright CiviCRM LLC (c) 2004-2015 * $Id$ * */ @@ -351,7 +351,7 @@ class CRM_Contact_BAO_GroupContact extends CRM_Contact_DAO_GroupContact { civicrm_subscription_history.method as method'; } - $where = " WHERE contact_a.id = %1 AND civicrm_group.is_active = 1 "; + $where = " WHERE contact_a.id = %1 AND civicrm_group.is_active = 1"; if ($excludeHidden) { $where .= " AND civicrm_group.is_hidden = 0 "; @@ -381,6 +381,10 @@ class CRM_Contact_BAO_GroupContact extends CRM_Contact_DAO_GroupContact { $from = CRM_Contact_BAO_Query::fromClause($tables); + //CRM-16945: seems hackish but as per CRM-16483 of using group criteria for Search Builder it is mandatory + //to include group_contact_cache clause when group table is present, so following code remove duplicacy + $from = str_replace("OR civicrm_group.id = civicrm_group_contact_cache.group_id", 'AND civicrm_group.saved_search_id IS NULL', $from); + $where .= " AND $permission "; if ($onlyPublicGroups) {