From f11b68e095eb55e5125a3cf32f7f3c23ef599265 Mon Sep 17 00:00:00 2001 From: Mattias Michaux Date: Wed, 4 May 2016 07:41:13 +0200 Subject: [PATCH] Fixed issue with ajax calls on custom field table tab on contact. --- CRM/Custom/Page/AJAX.php | 9 +++------ CRM/Profile/Page/MultipleRecordFieldsListing.php | 1 + .../CRM/Profile/Page/MultipleRecordFieldsListing.tpl | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CRM/Custom/Page/AJAX.php b/CRM/Custom/Page/AJAX.php index 1bd938996f..7bb96f7d24 100644 --- a/CRM/Custom/Page/AJAX.php +++ b/CRM/Custom/Page/AJAX.php @@ -125,11 +125,8 @@ class CRM_Custom_Page_AJAX { $obj->_contactType = $contactType; $obj->_DTparams['offset'] = ($params['page'] - 1) * $params['rp']; $obj->_DTparams['rowCount'] = $params['rp']; - if (isset($params['_raw_values']['sort'][0])) { - // Will this work when CiviCRM is translated, as searching happens on the label column? - // I can't find a place where the sort is added, but it should use the name, not the label. - $sort = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $params['_raw_values']['sort'][0], 'column_name', 'label'); - $obj->_DTparams['sort'] = $sort . ' ' . $params['_raw_values']['order'][0]; + if ($params['sortBy']) { + $obj->_DTparams['sort'] = $params['sortBy']; } list($fields, $attributes) = $obj->browse(); @@ -143,7 +140,7 @@ class CRM_Custom_Page_AJAX { $fieldName = array('data' => $fieldName, 'cellClass' => $attributes[$fieldId][$id]['class']); } if (is_numeric($fieldId)) { - $fName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $fieldId, 'label'); + $fName = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $fieldId, 'column_name'); CRM_Utils_Array::crmReplaceKey($value, $fieldId, $fName); } } diff --git a/CRM/Profile/Page/MultipleRecordFieldsListing.php b/CRM/Profile/Page/MultipleRecordFieldsListing.php index c27eb1953f..88410a1d2f 100644 --- a/CRM/Profile/Page/MultipleRecordFieldsListing.php +++ b/CRM/Profile/Page/MultipleRecordFieldsListing.php @@ -428,6 +428,7 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic { 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']; } } $this->assign('dateFields', $dateFields); diff --git a/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl b/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl index 5f6f091b58..4e3824e19b 100644 --- a/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl +++ b/templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl @@ -40,7 +40,7 @@ {if $pageViewType eq 'customDataView'} {foreach from=$headers key=recId item=head} - {ts}{$head}{/ts} -- 2.25.1