From b120248c5196063f19c03d17e61de58d87fb955b Mon Sep 17 00:00:00 2001 From: Abhishek Jain Date: Sat, 1 Oct 2016 19:27:56 +0530 Subject: [PATCH] CRM-19435 Fix --- CRM/Contact/BAO/GroupContact.php | 10 +++++++--- CRM/Contact/Page/View/GroupContact.php | 8 ++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CRM/Contact/BAO/GroupContact.php b/CRM/Contact/BAO/GroupContact.php index c25192a2b1..b2f6a84e20 100644 --- a/CRM/Contact/BAO/GroupContact.php +++ b/CRM/Contact/BAO/GroupContact.php @@ -340,7 +340,8 @@ class CRM_Contact_BAO_GroupContact extends CRM_Contact_DAO_GroupContact { $ignorePermission = FALSE, $onlyPublicGroups = FALSE, $excludeHidden = TRUE, - $groupId = NULL + $groupId = NULL, + $includeSmartGroups = FALSE ) { if ($count) { $select = 'SELECT count(DISTINCT civicrm_group_contact.id)'; @@ -357,8 +358,11 @@ 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 AND saved_search_id IS NULL"; - + $where = " WHERE contact_a.id = %1 AND civicrm_group.is_active = 1"; + if(!$includeSmartGroups){ + $where .= " AND saved_search_id IS NULL"; + } + if ($excludeHidden) { $where .= " AND civicrm_group.is_hidden = 0 "; } diff --git a/CRM/Contact/Page/View/GroupContact.php b/CRM/Contact/Page/View/GroupContact.php index ac8c20d51c..330796c4ce 100644 --- a/CRM/Contact/Page/View/GroupContact.php +++ b/CRM/Contact/Page/View/GroupContact.php @@ -37,11 +37,11 @@ class CRM_Contact_Page_View_GroupContact extends CRM_Core_Page { */ public function browse() { - $count = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, NULL, NULL, TRUE); + $count = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, NULL, NULL, TRUE, FALSE, FALSE, TRUE, NULL, TRUE); - $in = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Added'); - $pending = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Pending'); - $out = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Removed'); + $in = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Added', NULL, FALSE, FALSE, FALSE, TRUE, NULL, TRUE); + $pending = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Pending', NULL, FALSE, FALSE, FALSE, TRUE, NULL, TRUE); + $out = CRM_Contact_BAO_GroupContact::getContactGroup($this->_contactId, 'Removed', NULL, FALSE, FALSE, FALSE, TRUE, NULL, TRUE); // keep track of all 'added' contact groups so we can remove them from the smart group // section -- 2.25.1