From f1eae8d18e4233ff157fc0a27162c5cdb7b36947 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Mon, 3 Oct 2016 17:20:41 +0530 Subject: [PATCH] CRM-19352 - custom multi performance very slow --- CRM/Contact/Page/View/CustomData.php | 1 + CRM/Profile/Page/MultipleRecordFieldsListing.php | 13 +++++++++---- .../Profile/Page/MultipleRecordFieldsListing.tpl | 5 +---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CRM/Contact/Page/View/CustomData.php b/CRM/Contact/Page/View/CustomData.php index d8d5633751..1c6b9db637 100644 --- a/CRM/Contact/Page/View/CustomData.php +++ b/CRM/Contact/Page/View/CustomData.php @@ -134,6 +134,7 @@ class CRM_Contact_Page_View_CustomData extends CRM_Core_Page { $page->set('multiRecordFieldListing', $multiRecordFieldListing); $page->set('pageViewType', 'customDataView'); $page->set('contactType', $ctype); + $page->_headersOnly = TRUE; $page->assign('viewCustomData', array( $this->_groupId => array( $this->_groupId => $groupTree[$this->_groupId], diff --git a/CRM/Profile/Page/MultipleRecordFieldsListing.php b/CRM/Profile/Page/MultipleRecordFieldsListing.php index d973c27f5f..e2c2876528 100644 --- a/CRM/Profile/Page/MultipleRecordFieldsListing.php +++ b/CRM/Profile/Page/MultipleRecordFieldsListing.php @@ -171,7 +171,7 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic { public function browse() { $dateFields = NULL; $cgcount = 0; - $attributes = $headerAttr = array(); + $attributes = $result = $headerAttr = array(); $dateFieldsVals = NULL; if ($this->_pageViewType == 'profileDataView' && $this->_profileId) { $fields = CRM_Core_BAO_UFGroup::getFields($this->_profileId, FALSE, NULL, @@ -219,7 +219,7 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic { // from the above customGroupInfo we can get $this->_customGroupTitle $this->_customGroupTitle = $groupDetail[$customGroupId]['title']; } - if ($fieldIDs && !empty($fieldIDs) && $this->_contactId) { + if ($fieldIDs && !empty($fieldIDs) && $this->_contactId && empty($this->_headersOnly)) { $options = array(); $returnProperities = array( 'html_type', @@ -429,8 +429,13 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic { $headers = array(); if (!empty($fieldIDs)) { foreach ($fieldIDs as $fieldID) { - $headers[$fieldID] = ($this->_pageViewType == 'profileDataView') ? $customGroupInfo[$fieldID]['fieldLabel'] : $fieldLabels[$fieldID]['label']; - $headerAttr[$fieldID]['columnName'] = $fieldLabels[$fieldID]['column_name']; + if ($this->_pageViewType == 'profileDataView') { + $headers[$fieldID] = $customGroupInfo[$fieldID]['fieldLabel']; + } + else { + $headers[$fieldID] = $fieldLabels[$fieldID]['label']; + $headerAttr[$fieldID]['columnName'] = $fieldLabels[$fieldID]['column_name']; + } } } $this->assign('dateFields', $dateFields); diff --git a/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl b/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl index 089282fdbe..a9f04333a3 100644 --- a/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl +++ b/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl @@ -37,7 +37,6 @@ {strip} - {if $pageViewType eq 'customDataView'} {foreach from=$headers key=recId item=head} - {literal}
{/foreach}