From 4e9ab75a4226dae092f9b53fc254e51957678876 Mon Sep 17 00:00:00 2001 From: Ravish Nair Date: Mon, 25 Mar 2013 14:17:37 +0530 Subject: [PATCH] -- fix for CRM-12191 --- CRM/Campaign/BAO/Survey.php | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/CRM/Campaign/BAO/Survey.php b/CRM/Campaign/BAO/Survey.php index 3af9a1cdb6..bb79eddc42 100644 --- a/CRM/Campaign/BAO/Survey.php +++ b/CRM/Campaign/BAO/Survey.php @@ -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]; -- 2.25.1