fixes to handle group and tag display in selector for search builder, CRM-11790
authorKurund Jalmi <kurund@civicrm.org>
Fri, 19 Jul 2013 19:14:39 +0000 (00:44 +0530)
committerKurund Jalmi <kurund@civicrm.org>
Fri, 19 Jul 2013 19:14:39 +0000 (00:44 +0530)
CRM/Contact/BAO/Query.php
CRM/Contact/Selector.php

index c9d11fc4fbd2b6a7fc2a4e64a55449b82a3e0d90..63f2fb31be49f7223f65f66fa6bab74d8600167a 100644 (file)
@@ -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
index 9986741f6eb3a4737a51f85f1344c8ab4b49b722..14261fe63c9426d59cb2d2daf50f9118fc83fe27 100644 (file)
@@ -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 {