CRM-19352 - custom multi performance very slow
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Mon, 3 Oct 2016 11:50:41 +0000 (17:20 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Mon, 3 Oct 2016 11:50:41 +0000 (17:20 +0530)
CRM/Contact/Page/View/CustomData.php
CRM/Profile/Page/MultipleRecordFieldsListing.php
templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl

index d8d5633751de43a2a1789bdc77e14f80d453d070..1c6b9db637cc00d751af08ffc976aa48937c4cd2 100644 (file)
@@ -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],
index d973c27f5f3ecfacc5677377e2d27415ee1b41ee..e2c2876528c3d2ef6b580d48b8c199b87516e70c 100644 (file)
@@ -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);
index 089282fdbe4d3b55a8105baad7f12c0552e293d1..a9f04333a3f9c7f21f3d6fe69c750679004ed5d0 100644 (file)
@@ -37,7 +37,6 @@
         {strip}
           <table id="records-{$customGroupId}" class={if $pageViewType eq 'customDataView'}"crm-multifield-selector crm-ajax-table"{else}'display'{/if}>
             <thead>
-            <tr>
             {if $pageViewType eq 'customDataView'}
               {foreach from=$headers key=recId item=head}
                 <th data-data={ts}'{$headerAttr.$recId.columnName}'{/ts}
@@ -46,7 +45,6 @@
                 </th>
               {/foreach}
               <th data-data="action" data-orderable="false">&nbsp;</th>
-            </tr>
             </thead>
               {literal}
               <script type="text/javascript">
               {foreach from=$headers key=recId item=head}
                 <th>{ts}{$head}{/ts}</th>
               {/foreach}
-              
+
               {foreach from=$dateFields key=fieldId item=v}
                 <th class='hiddenElement'></th>
               {/foreach}
               <th>&nbsp;</th>
-              </tr>
               </thead>
               {foreach from=$records key=recId item=rows}
                 <tr class="{cycle values="odd-row,even-row"}">