From: Eileen McNaughton Date: Fri, 17 Nov 2023 03:42:48 +0000 (+1300) Subject: Align online membership receipt with other templates for line items, tax X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9933dabbf2610a85682bde411121bc50c875daf9;p=civicrm-core.git Align online membership receipt with other templates for line items, tax This uses the same code as the offline for the online which 1) removes the last usage on the mystical 'dataArray', allowing us to deprecate it and remove a lot of code 2) fixes one of the 3 known smarty3 issues in core --- diff --git a/tests/phpunit/api/v3/ContributionPageTest.php b/tests/phpunit/api/v3/ContributionPageTest.php index 1d6c1c7667..26da68452a 100644 --- a/tests/phpunit/api/v3/ContributionPageTest.php +++ b/tests/phpunit/api/v3/ContributionPageTest.php @@ -425,7 +425,7 @@ class api_v3_ContributionPageTest extends CiviUnitTestCase { $this->assertCount(2, $contributions); $this->callAPISuccess('membership_payment', 'getsingle', ['contribution_id' => ['IN' => array_keys($contributions)]]); $mut->checkMailLog([ - 'Membership Amount', + 'Membership Fee', '$2.00', ]); $mut->stop(); diff --git a/xml/templates/message_templates/membership_online_receipt_html.tpl b/xml/templates/message_templates/membership_online_receipt_html.tpl index 900a96362f..e469152b02 100644 --- a/xml/templates/message_templates/membership_online_receipt_html.tpl +++ b/xml/templates/message_templates/membership_online_receipt_html.tpl @@ -100,145 +100,84 @@ {/if} - {elseif empty($useForMember) && !empty($lineItem) and $priceSetID and empty($is_quick_config)} - {foreach from=$lineItem item=value key=priceset} - - - - - - - + {elseif $isShowLineItems} + + - - {/foreach} - - - + + + {/foreach} +
{ts}Item{/ts}{ts}Qty{/ts}{ts}Each{/ts}
+ + + + + {if $isShowTax && {contribution.tax_amount|boolean}} + + + - - {foreach from=$value item=line} - - - + {/if} + + + + {foreach from=$lineItems item=line} + + + + {if $isShowTax && {contribution.tax_amount|boolean}} + {if $line.tax_rate || $line.tax_amount != ""} + + + {else} + + + {/if} - - {/foreach} -
{ts}Item{/ts}{ts}Fee{/ts}{ts}SubTotal{/ts}{ts}Tax Rate{/ts}{ts}Tax Amount{/ts} {ts}Total{/ts}
- {$line.description|truncate:30:"..."} - - {$line.qty} - {ts}Membership Start Date{/ts}{ts}Membership Expiration Date{/ts}
{$line.title} + {$line.line_total|crmMoney} + - {$line.unit_price|crmMoney} + {$line.line_total|crmMoney:'{contribution.currency}'} + {$line.tax_rate|string_format:"%.2f"}% + + {$line.tax_amount|crmMoney:'{contribution.currency}'} + - {$line.line_total|crmMoney} + {$line.line_total_inclusive|crmMoney:'{contribution.currency}'}
-
- {ts}Total Amount{/ts} - - {$amount|crmMoney} + {/if} + + {$line.membership.start_date|crmDate:"Full"} + + {$line.membership.end_date|crmDate:"Full"} +
- {else} - {if $useForMember && $lineItem and empty($is_quick_config)} - {foreach from=$lineItem item=value key=priceset} - - - - - - - {if !empty($dataArray)} - - - - - {/if} - - - - {foreach from=$value item=line} - - - - {if !empty($dataArray)} - - {if ($line.tax_rate || $line.tax_amount != "")} - - - {else} - - - {/if} - - {/if} - - - - {/foreach} -
{ts}Item{/ts}{ts}Fee{/ts}{ts}SubTotal{/ts}{ts}Tax Rate{/ts}{ts}Tax Amount{/ts}{ts}Total{/ts}{ts}Membership Start Date{/ts}{ts}Membership Expiration Date{/ts}
- {if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description}
{$line.description|truncate:30:"..."}
{/if} -
- {$line.line_total|crmMoney} - - {$line.unit_price*$line.qty|crmMoney} - - {$line.tax_rate|string_format:"%.2f"}% - - {$line.tax_amount|crmMoney} - - {$line.line_total+$line.tax_amount|crmMoney} - - {$line.start_date} - - {$line.end_date} -
- - - {/foreach} - {if !empty($dataArray)} + {if $isShowTax && {contribution.tax_amount|boolean}} + + + {ts}Amount Before Tax:{/ts} + + + {contribution.tax_exclusive_amount} + + + {foreach from=$taxRateBreakdown item=taxDetail key=taxRate} - - {ts}Amount Before Tax:{/ts} - - - {contribution.tax_exclusive_amount} - + {if $taxRate == 0}{ts}No{/ts} {$taxTerm}{else} {$taxTerm} {$taxDetail.percentage}%{/if} + {$taxDetail.amount|crmMoney:'{contribution.currency}'} - {foreach from=$dataArray item=value key=priceset} - - {if $priceset || $priceset == 0} -  {$taxTerm} {$priceset|string_format:"%.2f"}% -  {$value|crmMoney:$currency} - {else} -  {ts}NO{/ts} {$taxTerm} -  {$value|crmMoney:$currency} - {/if} - - {/foreach} - {/if} - {/if} - {if $totalTaxAmount} - - - {ts}Total Tax Amount{/ts} - - - {$totalTaxAmount|crmMoney:$currency} - - - {/if} - - - {ts}Amount{/ts} - - - {$amount|crmMoney} {if isset($amount_level)} - {$amount_level}{/if} - - + {/foreach} + {/if} {/if} - + + + {ts}Amount{/ts} + + + {contribution.total_amount} {if isset($amount_level)} - {$amount_level}{/if} + + {elseif isset($membership_amount)}