This removes some isset that affect contact contribution tab if escape on output is enabled.
This might regress some smarty e-notices. I think if tests pass that is OK at this stage
as we never eliminted them & getting to security enablable seems like a higher priority
$this->appendFinancialTypeWhereAndFromToQueryStrings($where, $from);
- $summary = ['total' => []];
+ $summary = ['total' => [], 'soft_credit' => ['count' => 0, 'avg' => 0, 'amount' => 0]];
$this->addBasicStatsToSummary($summary, $where, $from);
if (CRM_Contribute_BAO_Query::isSoftCreditOptionEnabled()) {
GROUP BY currency";
$dao = CRM_Core_DAO::executeQuery($query);
-
+ $summary['cancel'] = ['count' => 0, 'amount' => 0, 'avg' => 0];
if ($dao->N <= 1) {
if ($dao->fetch()) {
$summary['cancel']['count'] = $dao->cancel_count;
{/if}
{foreach from=$columnHeaders item=header}
<th scope="col">
- {if isset($header.sort)}
+ {if $header.sort}
{assign var='key' value=$header.sort}
{$sort->_response.$key.link}
{elseif (!empty($header.name))}
</td>
{foreach from=$columnHeaders item=column}
{assign var='columnName' value=''}
- {if isset($column.field_name)}
+ {if $column.field_name}
{assign var='columnName' value=$column.field_name}
{/if}
{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 isset($column.type) && $column.type === 'actions'}{* rendered below as soft credit column handling = not fixed *}
+ {elseif $column.type === 'actions'}{* rendered below as soft credit column handling = not fixed *}
{elseif $columnName == 'contribution_status'}
<td class="crm-contribution-status">
{$row.contribution_status}<br/>
{/if}
</td>
{else}
- {if isset($column.type) && $column.type == 'date'}
+ {if $column.type == 'date'}
<td class="crm-contribution-{$columnName}">
{$row.$columnName|crmDate}
</td>
{else}
- <td class="crm-{$columnName} crm-{$columnName}_{if isset($row.columnName)}{$row.columnName}{/if}">
- {if isset($row.$columnName)}{$row.$columnName}{/if}
+ <td class="crm-{$columnName} crm-{$columnName}_{if $row.columnName}{$row.columnName}{/if}">
+ {$row.$columnName}
</td>
{/if}
{/if}
<th class="right"> {ts}# Completed{/ts} – {$contributionSummary.total.count}</th>
<th class="right contriTotalRight"> {ts}Avg{/ts} – {$contributionSummary.total.avg}</th>
{/if}
- {if isset($contributionSummary.cancel.amount)}
+ {if $contributionSummary.cancel.amount}
<th class="disabled right contriTotalRight"> {ts}Cancelled/Refunded{/ts} – {$contributionSummary.cancel.amount}</th>
{/if}
</tr>
- {if isset($contributionSummary.soft_credit.count)}
+ {if $contributionSummary.soft_credit.count}
{include file="CRM/Contribute/Page/ContributionSoftTotals.tpl" softCreditTotals=$contributionSummary.soft_credit}
{/if}
{/if}
*
* @throws \CRM_Core_Exception
*/
- public function testGetSummaryQueryWithFinancialACLDisabled() {
+ public function testGetSummaryQueryWithFinancialACLDisabled(): void {
$this->createContributionsForSummaryQueryTests();
// Test the function directly
'amount' => '$ 100.00',
'avg' => '$ 50.00',
],
+ 'soft_credit' => [
+ 'count' => 0,
+ 'avg' => 0,
+ 'amount' => 0,
+ ],
], $summary);
}
*
* @throws \CRM_Core_Exception
*/
- public function testGetSummaryQueryWithFinancialACLEnabled() {
+ public function testGetSummaryQueryWithFinancialACLEnabled(): void {
$where = $from = NULL;
$this->createContributionsForSummaryQueryTests();
$this->enableFinancialACLs();
'amount' => '$ 50.00',
'avg' => '$ 50.00',
],
+ 'soft_credit' => [
+ 'count' => 0,
+ 'avg' => 0,
+ 'amount' => 0,
+ ],
], $summary);
$this->disableFinancialACLs();
}