From fd18baa6c6fb5813a429c8cc520e97833b0b4747 Mon Sep 17 00:00:00 2001 From: Kurund Jalmi Date: Sat, 20 Jul 2013 00:44:39 +0530 Subject: [PATCH] fixes to handle group and tag display in selector for search builder, CRM-11790 --- CRM/Contact/BAO/Query.php | 11 ++++++++++- CRM/Contact/Selector.php | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index c9d11fc4fb..63f2fb31be 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -607,10 +607,19 @@ class CRM_Contact_BAO_Query { continue; } + //special handling for groups/tags + $makeException = FALSE; + if (in_array($name, array('groups', 'tags')) + && isset($this->_returnProperties[substr($name, 0, -1)]) + ) { + $makeException = TRUE; + } + $cfID = CRM_Core_BAO_CustomField::getKeyID($name); if ( CRM_Utils_Array::value($name, $this->_paramLookup) || - CRM_Utils_Array::value($name, $this->_returnProperties) + CRM_Utils_Array::value($name, $this->_returnProperties) || + $makeException ) { if ($cfID) { // add to cfIDs array if not present diff --git a/CRM/Contact/Selector.php b/CRM/Contact/Selector.php index 9986741f6e..14261fe63c 100644 --- a/CRM/Contact/Selector.php +++ b/CRM/Contact/Selector.php @@ -1073,6 +1073,9 @@ SELECT 'civicrm_contact', contact_a.id, contact_a.id, '$cacheKey', contact_a.dis $properties = array(); foreach ($returnProperties as $name => $value) { if ($name != 'location') { + if (in_array($name, array('group', 'tag'))) { + $name = "{$name}s"; + } $properties[] = $name; } else { -- 2.25.1