Replace complex logic in email templates with simple logic on billing name and credit card
Since we are doing tpl updates this month it would good to clean up some complex & kinda fragile logic using deprecated parameters
This is a fairly typical complex block from an email regarding whether to display a billing block
{if $contributeMode ne 'notify' and !$isAmountzero and (!$is_pay_later or $isBillingAddressRequiredForPayLater) and !$isOnWaitlist and !$isRequireApproval}
<tr>
<th {$headerStyle}>
{ts}Billing Name and Address{/ts}
</th>
</tr>
<tr>
<td colspan="2" {$valueStyle}>
{$billingName}<br />
{$address|nl2br}
</td>
</tr>
{/if}
But it can be simplified to
{if $billingName}
<tr>
<th {$headerStyle}>
{ts}Billing Name and Address{/ts}
</th>
</tr>
<tr>
<td colspan="2" {$valueStyle}>
{$billingName}<br />
{$address|nl2br}
</td>
</tr>
{/if}
on the basis we only collect the billingName & assign to to the tpl if wit is relevant.
Likewise
{if $contributeMode eq 'direct' AND !$is_pay_later AND ($amount GT 0 OR $membership_amount GT 0)}
<tr>
<th {$headerStyle}>
{ts}Credit Card Information{/ts}
</th>
</tr>
<tr>
<td colspan="2" {$valueStyle}>
{$credit_card_type}<br />
{$credit_card_number}<br />
{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}<br />
</td>
</tr>
{/if}
Can be simplified to
{if $credit_card_type}
<tr>
<th {$headerStyle}>
{ts}Credit Card Information{/ts}
</th>
</tr>
<tr>
<td colspan="2" {$valueStyle}>
{$credit_card_type}<br />
{$credit_card_number}<br />
{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}<br />
</td>
</tr>
{/if}
On the basis we only display card information if available & only collect it if we want it. I don't think we ever have any other details about the card when we don't have the card.