From: Seamus Lee Date: Sun, 6 Jun 2021 22:53:56 +0000 (+0000) Subject: [php8-compat] Fix api_v3_PaymentTest failures by putting in more guards into message... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=141c8460376d6d276713c4bd014af11aa8522553;p=civicrm-core.git [php8-compat] Fix api_v3_PaymentTest failures by putting in more guards into message templates --- diff --git a/xml/templates/message_templates/event_offline_receipt_html.tpl b/xml/templates/message_templates/event_offline_receipt_html.tpl index 5d7e661646..3f4b816c74 100644 --- a/xml/templates/message_templates/event_offline_receipt_html.tpl +++ b/xml/templates/message_templates/event_offline_receipt_html.tpl @@ -214,6 +214,7 @@ {/if} {/foreach} {if !empty($dataArray)} + {if isset($totalAmount) and isset($totalTaxAmount)} {ts}Amount Before Tax:{/ts} @@ -222,6 +223,7 @@ {$totalAmount-$totalTaxAmount|crmMoney} + {/if} {foreach from=$dataArray item=value key=priceset} {if $priceset || $priceset == 0} diff --git a/xml/templates/message_templates/event_offline_receipt_text.tpl b/xml/templates/message_templates/event_offline_receipt_text.tpl index c250fc316d..c5c1741a81 100644 --- a/xml/templates/message_templates/event_offline_receipt_text.tpl +++ b/xml/templates/message_templates/event_offline_receipt_text.tpl @@ -119,7 +119,9 @@ {/foreach} {if !empty($dataArray)} +{if isset($totalAmount) and isset($totalTaxAmount)} {ts}Amount before Tax{/ts}: {$totalAmount-$totalTaxAmount|crmMoney:$currency} +{/if} {foreach from=$dataArray item=value key=priceset} {if $priceset || $priceset == 0} diff --git a/xml/templates/message_templates/event_online_receipt_html.tpl b/xml/templates/message_templates/event_online_receipt_html.tpl index 2d37975d05..07b9e71a4c 100644 --- a/xml/templates/message_templates/event_online_receipt_html.tpl +++ b/xml/templates/message_templates/event_online_receipt_html.tpl @@ -257,6 +257,7 @@ {/if} {/foreach} {if !empty($dataArray)} + {if isset($totalAmount) and isset($totalTaxAmount)} {ts} Amount Before Tax: {/ts} @@ -265,6 +266,7 @@ {$totalAmount-$totalTaxAmount|crmMoney} + {/if} {foreach from=$dataArray item=value key=priceset} {if $priceset || $priceset == 0} diff --git a/xml/templates/message_templates/event_online_receipt_text.tpl b/xml/templates/message_templates/event_online_receipt_text.tpl index fba539841a..610b9b274a 100644 --- a/xml/templates/message_templates/event_online_receipt_text.tpl +++ b/xml/templates/message_templates/event_online_receipt_text.tpl @@ -139,7 +139,9 @@ You were registered by: {$payer.name} {""|string_format:"%120s"} {if !empty($dataArray)} +{if isset($totalAmount) and isset($totalTaxAmount)} {ts}Amount before Tax{/ts}: {$totalAmount-$totalTaxAmount|crmMoney:$currency} +{/if} {foreach from=$dataArray item=value key=priceset} {if $priceset || $priceset == 0} diff --git a/xml/templates/message_templates/membership_offline_receipt_html.tpl b/xml/templates/message_templates/membership_offline_receipt_html.tpl index 7a47a7717a..c40dd6eac8 100644 --- a/xml/templates/message_templates/membership_offline_receipt_html.tpl +++ b/xml/templates/message_templates/membership_offline_receipt_html.tpl @@ -145,6 +145,7 @@ {/foreach} {if !empty($dataArray)} + {if isset($formValues.total_amount) and isset($totalTaxAmount)} {ts}Amount Before Tax:{/ts} @@ -153,6 +154,7 @@ {$formValues.total_amount-$totalTaxAmount|crmMoney} + {/if} {foreach from=$dataArray item=value key=priceset} {if $priceset} diff --git a/xml/templates/message_templates/payment_or_refund_notification_html.tpl b/xml/templates/message_templates/payment_or_refund_notification_html.tpl index 025d2f7b87..f463c1022a 100644 --- a/xml/templates/message_templates/payment_or_refund_notification_html.tpl +++ b/xml/templates/message_templates/payment_or_refund_notification_html.tpl @@ -71,7 +71,7 @@ {/if} - {if $trxn_id} + {if !empty($trxn_id)} {ts}Transaction #{/ts} @@ -81,7 +81,7 @@ {/if} - {if $paidBy} + {if !empty($paidBy)} {ts}Paid By{/ts} @@ -91,7 +91,7 @@ {/if} - {if $checkNumber} + {if !empty($checkNumber)} {ts}Check Number{/ts} @@ -105,6 +105,7 @@ {ts}Contribution Details{/ts} + {if isset($totalAmount)} {ts}Total Fee{/ts} @@ -113,6 +114,8 @@ {$totalAmount|crmMoney} + {/if} + {if isset($totalPaid)} {ts}Total Paid{/ts} @@ -121,6 +124,8 @@ {$totalPaid|crmMoney} + {/if} + {if isset($amountOwed)} {ts}Balance Owed{/ts} @@ -129,6 +134,7 @@ {$amountOwed|crmMoney} {* This will be zero after final payment. *} + {/if} @@ -136,7 +142,7 @@ - {if $billingName || $address} + {if !empty($billingName) || !empty($address)} {/if} - {if $credit_card_number} + {if !empty($credit_card_number)}
{ts}Billing Name and Address{/ts} @@ -144,12 +150,12 @@
- {$billingName}
- {$address|nl2br} + {if !empty($billingName)}{$billingName}{/if}
+ {if !empty($address)}{$address|nl2br}{/if}
{ts}Credit Card Information{/ts} diff --git a/xml/templates/message_templates/payment_or_refund_notification_text.tpl b/xml/templates/message_templates/payment_or_refund_notification_text.tpl index 5529ec39da..3499b2f9f6 100644 --- a/xml/templates/message_templates/payment_or_refund_notification_text.tpl +++ b/xml/templates/message_templates/payment_or_refund_notification_text.tpl @@ -31,13 +31,13 @@ {if $receive_date} {ts}Transaction Date{/ts}: {$receive_date|crmDate} {/if} -{if $trxn_id} +{if !empty($trxn_id)} {ts}Transaction #{/ts}: {$trxn_id} {/if} -{if $paidBy} +{if !empty($paidBy)} {ts}Paid By{/ts}: {$paidBy} {/if} -{if $checkNumber} +{if !empty($checkNumber)} {ts}Check Number{/ts}: {$checkNumber} {/if} @@ -46,24 +46,33 @@ {ts}Contribution Details{/ts} =============================================================================== +{if isset($totalAmount)} {ts}Total Fee{/ts}: {$totalAmount|crmMoney} +{/if} +{if isset($totalPaid)} {ts}Total Paid{/ts}: {$totalPaid|crmMoney} +{/if} +{if isset($amountOwed)} {ts}Balance Owed{/ts}: {$amountOwed|crmMoney} {* This will be zero after final payment. *} +{/if} -{if $billingName || $address} +{if !empty($billingName) || !empty($address)} =============================================================================== {ts}Billing Name and Address{/ts} =============================================================================== - +{if !empty($billingName)} {$billingName} +{/if} +{if !empty($address)} {$address} {/if} +{/if} -{if $credit_card_number} +{if !empty($credit_card_number)} =========================================================== {ts}Credit Card Information{/ts} @@ -83,15 +92,15 @@ {$event.event_title} {$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|crmDate}{/if}{/if} -{if $event.participant_role} +{if !empty($event.participant_role)} {ts}Participant Role{/ts}: {$event.participant_role} {/if} -{if $isShowLocation} +{if !empty($isShowLocation)} {$location.address.1.display|strip_tags:false} {/if}{*End of isShowLocation condition*} -{if $location.phone.1.phone || $location.email.1.email} +{if !empty($location.phone.1.phone) || !empty($location.email.1.email)} {ts}Event Contacts:{/ts} {foreach from=$location.phone item=phone}