From ca000fa2fb74bfcda8b094c0ed1a28562a76c962 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Wed, 5 Jan 2022 19:19:20 +1300 Subject: [PATCH] Ensure assigned smarty array has empty keys (not no keys) --- CRM/Contribute/Selector/Search.php | 12 +++++++++++- templates/CRM/Contribute/Form/Selector.tpl | 7 ++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CRM/Contribute/Selector/Search.php b/CRM/Contribute/Selector/Search.php index 3f9a5dc2fb..764a597891 100644 --- a/CRM/Contribute/Selector/Search.php +++ b/CRM/Contribute/Selector/Search.php @@ -500,6 +500,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C 'sort' => 'total_amount', 'direction' => CRM_Utils_Sort::DONTCARE, 'field_name' => 'total_amount', + 'type' => '', ], ]; if ($this->_includeSoftCredits) { @@ -512,6 +513,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C 'sort' => 'contribution_soft_credit_amount', 'field_name' => 'contribution_soft_credit_amount', 'direction' => CRM_Utils_Sort::DONTCARE, + 'type' => '', ], ] ); @@ -525,12 +527,14 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C 'sort' => 'financial_type', 'field_name' => 'financial_type', 'direction' => CRM_Utils_Sort::DONTCARE, + 'type' => '', ], [ 'name' => ts('Source'), 'sort' => 'contribution_source', 'field_name' => 'contribution_source', 'direction' => CRM_Utils_Sort::DONTCARE, + 'type' => '', ], [ 'name' => ts('Received'), @@ -551,6 +555,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C 'sort' => 'contribution_status', 'field_name' => 'contribution_status', 'direction' => CRM_Utils_Sort::DONTCARE, + 'type' => '', ], ] ); @@ -560,6 +565,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C 'sort' => 'product_name', 'field_name' => 'product_name', 'direction' => CRM_Utils_Sort::DONTCARE, + 'type' => '', ]; } if (!$this->_single) { @@ -567,7 +573,9 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C [ 'name' => ts('Name'), 'sort' => 'sort_name', + 'field_name' => '', 'direction' => CRM_Utils_Sort::DONTCARE, + 'type' => '', ], ]; } @@ -580,11 +588,13 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C 'name' => ts('Soft Credit For'), 'sort' => 'contribution_soft_credit_name', 'direction' => CRM_Utils_Sort::DONTCARE, + 'field_name' => '', ], [ 'name' => ts('Soft Credit Type'), 'sort' => 'contribution_soft_credit_type', 'direction' => CRM_Utils_Sort::ASCENDING, + 'field_name' => '', ], ] ); @@ -592,7 +602,7 @@ class CRM_Contribute_Selector_Search extends CRM_Core_Selector_Base implements C self::$_columnHeaders = array_merge( self::$_columnHeaders, [ - ['desc' => ts('Actions'), 'type' => 'actions'], + ['desc' => ts('Actions'), 'type' => 'actions', 'field_name' => ''], ] ); foreach (array_keys(self::$_columnHeaders) as $index) { diff --git a/templates/CRM/Contribute/Form/Selector.tpl b/templates/CRM/Contribute/Form/Selector.tpl index 7b377458f2..d522a3fc87 100644 --- a/templates/CRM/Contribute/Form/Selector.tpl +++ b/templates/CRM/Contribute/Form/Selector.tpl @@ -56,10 +56,7 @@ {/if} {foreach from=$columnHeaders item=column} - {assign var='columnName' value=''} - {if $column.field_name} - {assign var='columnName' value=$column.field_name} - {/if} + {assign var='columnName' value=$column.field_name} {if !$columnName}{* if field_name has not been set skip, this helps with not changing anything not specifically edited *} {elseif $columnName === 'total_amount'}{* rendered above as soft credit columns = confusing *} {elseif $column.type === 'actions'}{* rendered below as soft credit column handling = not fixed *} @@ -76,7 +73,7 @@ {$row.$columnName|crmDate} {else} - + {$row.$columnName} {/if} -- 2.25.1