dev/core#2774 : Sort by date column on multirecord field listing section on profile...
authorMonish Deb <monish.deb@jmaconsulting.biz>
Fri, 20 Aug 2021 06:51:19 +0000 (12:21 +0530)
committerMonish Deb <monish.deb@jmaconsulting.biz>
Fri, 20 Aug 2021 20:36:10 +0000 (02:06 +0530)
CRM/Profile/Page/MultipleRecordFieldsListing.php
templates/CRM/Profile/Page/MultipleRecordFieldsListing.tpl

index 87486b1174e397629229ed99194697d441b8b473..91f10d1badeecdbf6a60506945baedf990617ad4 100644 (file)
@@ -307,7 +307,12 @@ class CRM_Profile_Page_MultipleRecordFieldsListing extends CRM_Core_Page_Basic {
               $customValue = &$val;
               if (!empty($dateFields) && array_key_exists($fieldId, $dateFields)) {
                 // formatted date capture value capture
-                $dateFieldsVals[$fieldId][$recId] = CRM_Core_BAO_CustomField::displayValue($customValue, $fieldId);
+                if ($this->_pageViewType == 'profileDataView') {
+                  $dateFieldsVals[$fieldId][$recId] = CRM_Utils_Date::processDate($result[$recId][$fieldId], NULL, FALSE, 'YmdHis');
+                }
+                else {
+                  $dateFieldsVals[$fieldId][$recId] = CRM_Core_BAO_CustomField::displayValue($customValue, $fieldId);
+                }
 
                 //set date and time format
                 switch ($timeFormat) {
index 04deb6cd1bd4fe70f37468599bc2a6cd02ca7e11..1f0916095fb6e483ff3ee1d1c19f319524ad2bde 100644 (file)
@@ -75,7 +75,7 @@
               {foreach from=$records key=recId item=rows}
                 <tr class="{cycle values="odd-row,even-row"}">
                   {foreach from=$headers key=hrecId item=head}
-                    <td {crmAttributes a=$attributes.$hrecId.$recId}>{$rows.$hrecId}</td>
+                    <td {if !empty($dateFieldsVals.$hrecId)}data-order="{$dateFieldsVals.$hrecId.$recId|crmDate:'%Y-%m-%d'}"{/if} {crmAttributes a=$attributes.$hrecId.$recId}>{$rows.$hrecId}</td>
                   {/foreach}
                   <td>{$rows.action}</td>
                   {foreach from=$dateFieldsVals key=fid item=rec}