I'm thinking this should fail on some notices on CI - so will follow with the fix
$cachingValue = $smarty->caching;
$smarty->caching = 0;
$smarty->assign('smartySingleUseString', $templateString);
- $templateString = $smarty->fetch('string:{eval var=$smartySingleUseString}');
+ // Do not escape the smartySingleUseString as that is our smarty template
+ // and is likely to contain html.
+ $templateString = (string) $smarty->fetch('string:{eval var=$smartySingleUseString|smarty:nodefaults}');
$smarty->caching = $cachingValue;
$smarty->assign('smartySingleUseString', NULL);
return $templateString;
* @param string $templateName
* @param string $type
*/
- protected function swapMessageTemplateForTestTemplate($templateName = 'contribution_online_receipt', $type = 'html') {
+ protected function swapMessageTemplateForTestTemplate($templateName = 'contribution_online_receipt', $type = 'html'): void {
$testTemplate = file_get_contents(__DIR__ . '/../../templates/message_templates/' . $templateName . '_' . $type . '.tpl');
CRM_Core_DAO::executeQuery(
"UPDATE civicrm_msg_template
/**
* Test completing a transaction via the API with a non-USD transaction.
*/
- public function testCompleteTransactionEuro() {
+ public function testCompleteTransactionEuro(): void {
$mut = new CiviMailUtils($this, TRUE);
$this->swapMessageTemplateForTestTemplate();
$this->createLoggedInUser();
contactID:::{$contactID}
contributionID:::{$contributionID}
amount:::{$amount}
- {if isset($amount_level)}
+ {if !empty($amount_level)}
amount_level:::{$amount_level}
{/if}
- {if isset($pay_later_receipt)}
+ {if !empty($pay_later_receipt)}
pay_later_receipt:::{$pay_later_receipt}
{/if}
- {if isset($headerstyle)}
+ {if !empty($headerstyle)}
headerStyle:::{$headerStyle}
{/if}
- {if isset($valueStyle)}
+ {if !empty($valueStyle)}
valueStyle:::{$valueStyle}
{/if}
- {if isset($labelStyle)}
+ {if !empty($labelStyle)}
labelStyle:::{$labelStyle}
{/if}
priceSetID:::{$priceSetID}
getTaxDetails:::{$getTaxDetails}
totalTaxAmount:::{$totalTaxAmount}
{/if}
- {if isset($is_monetary)}
+ {if !empty($is_monetary)}
is_monetary:::{$is_monetary}
{/if}
- {if isset($isShare)}
+ {if !empty($isShare)}
isShare:::{$isShare}
{/if}
honor_block_is_active:::{$honor_block_is_active}
{if $honor_block_is_active}
soft_credit_type:::{$soft_credit_type}
{/if}
- {if isset($is_recur)}
+ {if !empty($is_recur)}
is_recur:::{$is_recur}
{/if}
- {if isset($trxn_id)}
+ {if !empty($trxn_id)}
trxn_id:::{$trxn_id}
{/if}
- {if isset($cancelSubscriptionUrl)}
+ {if !empty($cancelSubscriptionUrl)}
cancelSubscriptionUrl:::{$cancelSubscriptionUrl}
updateSubscriptionBillingUrl:::{$updateSubscriptionBillingUrl}
updateSubscriptionUrl:::{$updateSubscriptionUrl}
{/if}
- {if isset($priceset)}
+ {if !empty($priceset)}
priceset:::{$priceset}
{/if}
- {if isset($taxTerm)}
+ {if !empty($taxTerm)}
taxTerm:::{$taxTerm}
{/if}
{if !empty($pcpBlock)}
pcp_roll_nickname:::{$pcp_roll_nickname}
pcp_personal_note:::{$pcp_personal_note}
{/if}
- {if isset($onBehalfProfile_grouptitle)}
+ {if !empty($onBehalfProfile_grouptitle)}
onBehalfProfile_grouptitle:::{$onBehalfProfile_grouptitle}
{/if}
email:::{$email}
- {if isset($contributionPageId)}
+ {if !empty($contributionPageId)}
contributionPageId:::{$contributionPageId}
title:::{$title}
{/if}
- {if isset($isBillingAddressRequiredForPayLater)}
+ {if !empty($isBillingAddressRequiredForPayLater)}
isBillingAddressRequiredForPayLater:::{$isBillingAddressRequiredForPayLater}
{/if}
- {if isset($billingName)}
+ {if !empty($billingName)}
billingName:::{$billingName}
address:::{$address}
{/if}
- {if isset($credit_card_type)}
+ {if !empty($credit_card_type)}
credit_card_type:::{$credit_card_type}
credit_card_number:::{$credit_card_number}
credit_card_exp_date:::{$credit_card_exp_date}
{/if}
- {if isset($selectPremium)}
+ {if !empty($selectPremium)}
selectPremium:::{$selectPremium}
product_name:::{$product_name}
option:::{$option}
sku:::{$sku}
{/if}
- {if isset($start_date)}
+ {if !empty($start_date)}
start_date:::{$start_date}
end_date:::{$end_date}
{/if}
- {if isset($is_deductible)}
+ {if !empty($is_deductible)}
is_deductible:::{$is_deductible}
{/if}
- {if isset($contact_email)}
+ {if !empty($contact_email)}
contact_email:::{$contact_email}
{/if}
- {if isset($contact_phone)}
+ {if !empty($contact_phone)}
contact_phone:::{$contact_phone}
{/if}
- {if isset($price)}
+ {if !empty($price)}
price:::{$price}
{/if}
- {if isset($customPre_grouptitle)}
+ {if !empty($customPre_grouptitle)}
customPre_grouptitle:::{$customPre_grouptitle}
{/if}
- {if isset($customPost_grouptitle)}
+ {if !empty($customPost_grouptitle)}
customPost_grouptitle:::{$customPost_grouptitle}
{/if}
contributionStatus:::{$contributionStatus}
- {if isset($lineItem)}
+ {if !empty($lineItem)}
{foreach from=$lineItem item=value key=priceset}
{foreach from=$value item=line}
line.html_type:::{$line.html_type}
line.description:::{$line.description}
line.qty:::{$line.qty}
line.unit_price:::{$line.unit_price}
- {if isset($line.tax_rate)}
+ {if !empty($line.tax_rate)}
line.tax_rate:::{$line.tax_rate}
line.tax_amount:::{$line.tax_amount}
{/if}
<th style="text-align:left;font-weight:bold;width:100%"><font size="1">{ts}Description{/ts}</font></th>
<th style="text-align:right;font-weight:bold;white-space: nowrap"><font size="1">{ts}Quantity{/ts}</font></th>
<th style="text-align:right;font-weight:bold;white-space: nowrap"><font size="1">{ts}Unit Price{/ts}</font></th>
- <th style="text-align:right;font-weight:bold;white-space: nowrap"><font size="1">{if isset($taxTerm)}{$taxTerm}{/if}</font></th>
+ <th style="text-align:right;font-weight:bold;white-space: nowrap"><font size="1">{$taxTerm}</font></th>
<th style="text-align:right;font-weight:bold;white-space: nowrap"><font size="1">{ts 1=$currency}Amount %1{/ts}</font></th>
</tr>
{foreach from=$lineItem item=value key=priceset name=taxpricevalue}
{if $value.tax_amount != ''}
<td style="text-align:right;"><font size="1">{if isset($value.tax_rate)}{$value.tax_rate}%{/if}</font></td>
{else}
- <td style="text-align:right;"><font size="1">{if isset($taxTerm)}{ts 1=$taxTerm}-{/ts}{/if}</font></td>
+ <td style="text-align:right;"><font size="1">{if $taxTerm}{ts 1=$taxTerm}-{/ts}{/if}</font></td>
{/if}
<td style="text-align:right;"><font size="1">{$value.subTotal|crmMoney:$currency}</font></td>
</tr>
<tr>
<td colspan="3"></td>
{if $priceset}
- <td style="text-align:right;white-space: nowrap"><font size="1">{if isset($taxTerm)}{ts 1=$taxTerm 2=$priceset}TOTAL %1 %2%{/ts}{/if}</font></td>
+ <td style="text-align:right;white-space: nowrap"><font size="1">{if $taxTerm}{ts 1=$taxTerm 2=$priceset}TOTAL %1 %2%{/ts}{/if}</font></td>
<td style="text-align:right"><font size="1" align="right">{$value|crmMoney:$currency}</font> </td>
{elseif $priceset == 0}
- <td style="text-align:right;white-space: nowrap"><font size="1">{if isset($taxTerm)}{ts 1=$taxTerm}TOTAL %1{/ts}{/if}</font></td>
+ <td style="text-align:right;white-space: nowrap"><font size="1">{if $taxTerm}{ts 1=$taxTerm}TOTAL %1{/ts}{/if}</font></td>
<td style="text-align:right"><font size="1" align="right">{$value|crmMoney:$currency}</font> </td>
{/if}
</tr>
<th style="padding-right:28px;text-align:left;font-weight:bold;width:200px;"><font size="1">{ts}Description{/ts}</font></th>
<th style="padding-left:28px;text-align:right;font-weight:bold;"><font size="1">{ts}Quantity{/ts}</font></th>
<th style="padding-left:28px;text-align:right;font-weight:bold;"><font size="1">{ts}Unit Price{/ts}</font></th>
- <th style="padding-left:28px;text-align:right;font-weight:bold;"><font size="1">{if isset($taxTerm)}{$taxTerm}{/if}</font></th>
+ <th style="padding-left:28px;text-align:right;font-weight:bold;"><font size="1">{$taxTerm}</font></th>
<th style="padding-left:28px;text-align:right;font-weight:bold;"><font size="1">{ts 1=$currency}Amount %1{/ts}</font></th>
</tr>
{foreach from=$lineItem item=value key=priceset name=pricevalue}
{if $value.tax_amount != ''}
<td style="padding-left:28px;text-align:right;"><font size="1">{if isset($value.tax_rate)}{$value.tax_rate}%{/if}</font></td>
{else}
- <td style="padding-left:28px;text-align:right"><font size="1">{if isset($taxTerm)}{ts 1=$taxTerm}No %1{/ts}{/if}</font></td>
+ <td style="padding-left:28px;text-align:right"><font size="1">{if $taxTerm}{ts 1=$taxTerm}No %1{/ts}{/if}</font></td>
{/if}
<td style="padding-left:28px;text-align:right;"><font size="1">{$value.subTotal|crmMoney:$currency}</font></td>
</tr>
<tr>
<td colspan="3"></td>
{if $priceset}
- <td style="padding-left:28px;text-align:right;"><font size="1">{if isset($taxTerm)}{ts 1=$taxTerm 2=$priceset}TOTAL %1 %2%{/ts}{/if}</font></td>
+ <td style="padding-left:28px;text-align:right;"><font size="1">{if $taxTerm}{ts 1=$taxTerm 2=$priceset}TOTAL %1 %2%{/ts}{/if}</font></td>
<td style="padding-left:28px;text-align:right;"><font size="1" align="right">{$value|crmMoney:$currency}</font> </td>
{elseif $priceset == 0}
- <td style="padding-left:28px;text-align:right;"><font size="1">{if isset($taxTerm)}{ts 1=$taxTerm}TOTAL NO %1{/ts}{/if}</font></td>
+ <td style="padding-left:28px;text-align:right;"><font size="1">{if $taxTerm}{ts 1=$taxTerm}TOTAL NO %1{/ts}{/if}</font></td>
<td style="padding-left:28px;text-align:right;"><font size="1" align="right">{$value|crmMoney:$currency}</font> </td>
{/if}
</tr>
{foreach from=$dataArray item=value key=priceset}
<tr>
{if $priceset || $priceset == 0 || $value != ''}
- <td> {if isset($taxTerm)}{$taxTerm}{/if} {$priceset|string_format:"%.2f"}%</td>
+ <td> {$taxTerm} {$priceset|string_format:"%.2f"}%</td>
<td> {$value|crmMoney:$currency}</td>
{else}
- <td> {ts}No{/ts} {if isset($taxTerm)}{$taxTerm}{/if}</td>
+ <td> {ts}No{/ts} {$taxTerm}</td>
<td> {$value|crmMoney:$currency}</td>
{/if}
</tr>
{foreach from=$dataArray item=value key=priceset}
{if $priceset || $priceset == 0 || $value != ''}
-{if isset($taxTerm)}{$taxTerm}{/if} {$priceset|string_format:"%.2f"}% : {$value|crmMoney:$currency}
+{$taxTerm} {$priceset|string_format:"%.2f"}% : {$value|crmMoney:$currency}
{else}
-{ts}No{/ts} {if isset($taxTerm)}{$taxTerm}{/if} : {$value|crmMoney:$currency}
+{ts}No{/ts} {$taxTerm} : {$value|crmMoney:$currency}
{/if}
{/foreach}
{/if}
{foreach from=$dataArray item=value key=priceset}
<tr>
{if $priceset || $priceset == 0}
- <td> {if isset($taxTerm)}{$taxTerm}{/if} {$priceset|string_format:"%.2f"}%</td>
+ <td> {$taxTerm} {$priceset|string_format:"%.2f"}%</td>
<td> {$value|crmMoney:$currency}</td>
{else}
- <td> {ts}No{/ts} {if isset($taxTerm)}{$taxTerm}{/if}</td>
+ <td> {ts}No{/ts} {$taxTerm}</td>
<td> {$value|crmMoney:$currency}</td>
{/if}
</tr>
{if $is_pay_later}
===========================================================
-{if isset($pay_later_receipt)}{$pay_later_receipt}{/if}
+{$pay_later_receipt}
===========================================================
{/if}
{foreach from=$dataArray item=value key=priceset}
{if $priceset || $priceset == 0}
-{if isset($taxTerm)}{$taxTerm}{/if} {$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency}
+{$taxTerm} {$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency}
{else}
-{ts}No{/ts} {if isset($taxTerm)}{$taxTerm}{/if}: {$value|crmMoney:$currency}
+{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency}
{/if}
{/foreach}
{/if}
{foreach from=$dataArray item=value key=priceset}
<tr>
{if $priceset || $priceset == 0}
- <td> {if isset($taxTerm)}{$taxTerm}{/if} {$priceset|string_format:"%.2f"}%</td>
+ <td> {$taxTerm} {$priceset|string_format:"%.2f"}%</td>
<td> {$value|crmMoney:$currency}</td>
{else}
- <td> {ts}No{/ts} {if isset($taxTerm)}{$taxTerm}{/if}</td>
+ <td> {ts}No{/ts} {$taxTerm}</td>
<td> {$value|crmMoney:$currency}</td>
{/if}
</tr>
{foreach from=$dataArray item=value key=priceset}
{if $priceset || $priceset == 0}
-{if isset($taxTerm)}{$taxTerm}{/if} {$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency}
+{$taxTerm} {$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency}
{else}
-{ts}No{/ts} {if isset($taxTerm)}{$taxTerm}{/if}: {$value|crmMoney:$currency}
+{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency}
{/if}
{/foreach}
{/if}
{foreach from=$dataArray item=value key=priceset}
<tr>
{if $priceset || $priceset == 0}
- <td> {if isset($taxTerm)}{$taxTerm}{/if} {$priceset|string_format:"%.2f"}%</td>
+ <td> {$taxTerm} {$priceset|string_format:"%.2f"}%</td>
<td> {$value|crmMoney:$currency}</td>
{else}
- <td> {ts}No{/ts} {if isset($taxTerm)}{$taxTerm}{/if}</td>
+ <td> {ts}No{/ts} {$taxTerm}</td>
<td> {$value|crmMoney:$currency}</td>
{/if}
</tr>
{foreach from=$dataArray item=value key=priceset}
{if $priceset || $priceset == 0}
-{if isset($taxTerm)}{$taxTerm}{/if} {$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency}
+{$taxTerm} {$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency}
{else}
-{ts}No{/ts} {if isset($taxTerm)}{$taxTerm}{/if}: {$value|crmMoney:$currency}
+{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency}
{/if}
{/foreach}
{/if}
{foreach from=$dataArray item=value key=priceset}
<tr>
{if $priceset}
- <td> {if isset($taxTerm)}{$taxTerm}{/if} {$priceset|string_format:"%.2f"}%</td>
+ <td> {$taxTerm} {$priceset|string_format:"%.2f"}%</td>
<td> {$value|crmMoney:$currency}</td>
{elseif $priceset == 0}
- <td> {ts}No{/ts} {if isset($taxTerm)}{$taxTerm}{/if}</td>
+ <td> {ts}No{/ts} {$taxTerm}</td>
<td> {$value|crmMoney:$currency}</td>
{/if}
</tr>
{foreach from=$dataArray item=value key=priceset}
{if $priceset}
-{if isset($taxTerm)}{$taxTerm}{/if} {$priceset|string_format:"%.2f"} %: {$value|crmMoney:$currency}
+{$taxTerm} {$priceset|string_format:"%.2f"} %: {$value|crmMoney:$currency}
{elseif $priceset == 0}
-{ts}No{/ts} {if isset($taxTerm)}{$taxTerm}{/if}: {$value|crmMoney:$currency}
+{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency}
{/if}
{/foreach}
{/if}
{foreach from=$dataArray item=value key=priceset}
<tr>
{if $priceset || $priceset == 0}
- <td> {if isset($taxTerm)}{$taxTerm}{/if} {$priceset|string_format:"%.2f"}%</td>
+ <td> {$taxTerm} {$priceset|string_format:"%.2f"}%</td>
<td> {$value|crmMoney:$currency}</td>
{else}
- <td> {ts}NO{/ts} {if isset($taxTerm)}{$taxTerm}{/if}</td>
+ <td> {ts}NO{/ts} {$taxTerm}</td>
<td> {$value|crmMoney:$currency}</td>
{/if}
</tr>
{foreach from=$dataArray item=value key=priceset}
{if $priceset || $priceset == 0}
-{if isset($taxTerm)}{$taxTerm}{/if} {$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency}
+{$taxTerm} {$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency}
{else}
-{ts}No{/ts} {if isset($taxTerm)}{$taxTerm}{/if}: {$value|crmMoney:$currency}
+{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency}
{/if}
{/foreach}
{/if}