-- fix for CRM-12191
authorRavish Nair <ravish@ravish.(none)>
Mon, 25 Mar 2013 08:47:37 +0000 (14:17 +0530)
committerRavish Nair <ravish@ravish.(none)>
Mon, 25 Mar 2013 08:47:37 +0000 (14:17 +0530)
CRM/Campaign/BAO/Survey.php

index 3af9a1cdb6eb2364586633c837eedaf0f68dc52d..bb79eddc42872961ff6a495b3904e9a243327f05 100644 (file)
@@ -954,31 +954,24 @@ INNER JOIN  civicrm_contact contact_a ON ( activityTarget.target_contact_id = co
     foreach ($profileFields as $name => $field) {
       //get only contact and activity fields.
       //later stage we might going to consider contact type also.
-      if (!in_array($field['field_type'], $supportableFieldTypes)) {
-        continue;
-      }
-      if ($field['name'] == 'activity_engagement_level') {
-        $responseFields[$cacheKey][$name] = $field;        
-      }
-      // we should allow all supported custom data for survey
-      // In case of activity, allow normal activity and with subtype survey,
-      // suppress custom data of other activity types
-      if (CRM_Core_BAO_CustomField::getKeyID($name) &&
-        !in_array($field['html_type'], $removeFields)
-      ) {
-        if ($field['field_type'] != 'Activity') {
-          $responseFields[$cacheKey][$name] = $field;
+      if (in_array($field['field_type'], $supportableFieldTypes)) {
+        // we should allow all supported custom data for survey
+        // In case of activity, allow normal activity and with subtype survey,
+        // suppress custom data of other activity types
+        if (CRM_Core_BAO_CustomField::getKeyID($name)) {
+          if (!in_array($field['html_type'], $removeFields)) {
+            if ($field['field_type'] != 'Activity') {
+              $responseFields[$cacheKey][$name] = $field;
+            }
+            elseif (array_key_exists(CRM_Core_BAO_CustomField::getKeyID($name), $customFields)) {
+              $responseFields[$cacheKey][$name] = $field;
+            }
+          }
         }
-        elseif (array_key_exists(CRM_Core_BAO_CustomField::getKeyID($name), $customFields)) {
+        else {
           $responseFields[$cacheKey][$name] = $field;
         }
       }
-      elseif (in_array('Primary', explode('-', $name)) ||
-        CRM_Utils_Array::value('location_type_id', $field)
-      ) {
-        //get location related contact fields.
-        $responseFields[$cacheKey][$name] = $field;
-      }
     }
 
     return $responseFields[$cacheKey];