From fa8f14174eff9e97ea823e7e61d469d5ee37c774 Mon Sep 17 00:00:00 2001 From: magnolia61 Date: Wed, 4 Mar 2020 09:03:25 +0100 Subject: [PATCH] Style & layout clean up --- CRM/Upgrade/Incremental/MessageTemplates.php | 7 + .../CRM/Contribute/Form/Task/InvoiceTest.php | 8 +- .../contribution_invoice_receipt_html.tpl | 420 ++++++++---------- 3 files changed, 207 insertions(+), 228 deletions(-) diff --git a/CRM/Upgrade/Incremental/MessageTemplates.php b/CRM/Upgrade/Incremental/MessageTemplates.php index 1a7c945a80..0b86bc6a6d 100644 --- a/CRM/Upgrade/Incremental/MessageTemplates.php +++ b/CRM/Upgrade/Incremental/MessageTemplates.php @@ -208,6 +208,13 @@ class CRM_Upgrade_Incremental_MessageTemplates { ['name' => 'participant_confirm', 'type' => 'html'], ], ], + [ + 'version' => '5.24.alpha1', + 'upgrade_descriptor' => ts('Layout fixes for the Contribution templates'), + 'templates' => [ + ['name' => 'contribution_invoice_receipt', 'type' => 'html'], + ], + ], ]; } diff --git a/tests/phpunit/CRM/Contribute/Form/Task/InvoiceTest.php b/tests/phpunit/CRM/Contribute/Form/Task/InvoiceTest.php index 22eb76c60e..a38b8a2e95 100644 --- a/tests/phpunit/CRM/Contribute/Form/Task/InvoiceTest.php +++ b/tests/phpunit/CRM/Contribute/Form/Task/InvoiceTest.php @@ -73,8 +73,8 @@ class CRM_Contribute_Form_Task_InvoiceTest extends CiviUnitTestCase { $this->assertContains('Due Date', $invoiceHTML[$contribution['id']]); $this->assertContains('PAYMENT ADVICE', $invoiceHTML[$contribution['id']]); - $this->assertContains('AMOUNT DUE: - $ 92.00', $invoiceHTML[$contribution3['id']]); + $this->assertContains('AMOUNT DUE: + $ 92.00', $invoiceHTML[$contribution3['id']]); } @@ -153,12 +153,12 @@ class CRM_Contribute_Form_Task_InvoiceTest extends CiviUnitTestCase { $lineItems = $this->callAPISuccess('LineItem', 'get', ['contribution_id' => $order['id']]); foreach ($lineItems['values'] as $lineItem) { - $this->assertContains("$ {$lineItem['line_total']}", $invoiceHTML); + $this->assertContains("$ {$lineItem['line_total']}", $invoiceHTML); } $totalAmount = $this->formatMoneyInput($order['values'][$order['id']]['total_amount']); $this->assertContains("TOTAL USD - $ $totalAmount", $invoiceHTML); + $ $totalAmount", $invoiceHTML); } diff --git a/xml/templates/message_templates/contribution_invoice_receipt_html.tpl b/xml/templates/message_templates/contribution_invoice_receipt_html.tpl index 1a7b64bf5b..d6093e8510 100644 --- a/xml/templates/message_templates/contribution_invoice_receipt_html.tpl +++ b/xml/templates/message_templates/contribution_invoice_receipt_html.tpl @@ -1,102 +1,89 @@ - + - + - - - - -
-
- +
+ {if $config->empoweredBy} +
+ + + +
+ {/if} + - - - - + + + {if $organization_name} - + {else} - + {/if} - - - + - - - + + - - - - + + - - - - + + + - - - - + + + - - +
{ts}INVOICE{/ts}{ts}Invoice Date:{/ts}{$domain_organization}{ts}INVOICE{/ts}{ts}Invoice Date:{/ts}{$domain_organization}
{$display_name} ({$organization_name}){$display_name} ({$organization_name}){$display_name}{$display_name}{$invoice_date} - + {$invoice_date} + {if $domain_street_address }{$domain_street_address}{/if} {if $domain_supplemental_address_1 }{$domain_supplemental_address_1}{/if} - +
{$street_address} {$supplemental_address_1}{ts}Invoice Number:{/ts}{$street_address} {$supplemental_address_1}{ts}Invoice Number:{/ts} - + {if $domain_supplemental_address_2 }{$domain_supplemental_address_2}{/if} {if $domain_state }{$domain_state}{/if} - +
{$supplemental_address_2} {$stateProvinceAbbreviation}{$invoice_number} - + {$supplemental_address_2} {$stateProvinceAbbreviation}{$invoice_number} + {if $domain_city}{$domain_city}{/if} {if $domain_postal_code }{$domain_postal_code}{/if} - +
{$city} {$postal_code}{ts}Reference:{/ts} {if $domain_country}{$domain_country}{/if}{$city} {$postal_code}{ts}Reference:{/ts}{if $domain_country}{$domain_country}{/if}
{$source} {if $domain_phone}{$domain_phone}{/if} {$country}{$source}{if $domain_email}{$domain_email}{/if}
{if $domain_email}{$domain_email}{/if} {if $domain_phone}{$domain_phone}{/if}
- - -
- {* FIXME: style this table so that it looks like the text version (justification, etc.) *} + +
- - - - - + + + + + {foreach from=$lineItem item=value key=priceset name=taxpricevalue} {if $smarty.foreach.taxpricevalue.index eq 0} - - - {else} - - - {/if} - - - + + {if $value.tax_amount != ''} - + {else} - + {/if} - + {/foreach} - - - - + + + - {foreach from = $dataArray item = value key = priceset} + {foreach from=$dataArray item=value key=priceset} - + {if $priceset} - - + + {elseif $priceset == 0} - - + + {/if} {/foreach} - - - - - - - - + + + - {if $is_pay_later == 0} + {if $amountDue != 0} - - + - + - - + + - - - - + + + {/if}


- + {if $contribution_status_id == $pendingStatusId && $is_pay_later == 1} - - + + {/if}
{ts}Description{/ts}{ts}Quantity{/ts}{ts}Unit Price{/ts}{$taxTerm} {ts 1=$defaultCurrency}Amount %1{/ts}{ts}Description{/ts}{ts}Quantity{/ts}{ts}Unit Price{/ts}{$taxTerm}{ts 1=$defaultCurrency}Amount %1{/ts}


+ {if $value.html_type eq 'Text'} {$value.label} {else} @@ -105,246 +92,228 @@ {if $value.description}
{$value.description|truncate:30:"..."}
{/if} -
+
{$value.qty} {$value.unit_price|crmMoney:$currency}{$value.qty}{$value.unit_price|crmMoney:$currency} {$value.tax_rate}%{$value.tax_rate}%{ts 1=$taxTerm}No %1{/ts}{ts 1=$taxTerm}-{/ts}{$value.subTotal|crmMoney:$currency}{$value.subTotal|crmMoney:$currency}

{ts}Sub Total{/ts} {$subTotal|crmMoney:$currency}{ts}Sub Total{/ts}{$subTotal|crmMoney:$currency}
{ts 1=$taxTerm 2=$priceset}TOTAL %1 %2%{/ts}{$value|crmMoney:$currency} {ts 1=$taxTerm 2=$priceset}TOTAL %1 %2%{/ts}{$value|crmMoney:$currency} {ts 1=$taxTerm}TOTAL NO %1{/ts}{$value|crmMoney:$currency} {ts 1=$taxTerm}TOTAL %1{/ts}{$value|crmMoney:$currency}

{ts 1=$defaultCurrency}TOTAL %1{/ts}{$amount|crmMoney:$currency}{ts 1=$defaultCurrency}TOTAL %1{/ts}{$amount|crmMoney:$currency}
+ {if $contribution_status_id == $refundedStatusId} - {ts}LESS Amount Credited{/ts} + {ts}Amount Credited{/ts} {else} - {ts}LESS Amount Paid{/ts} + {ts}Amount Paid{/ts} {/if} - + {$amountPaid|crmMoney:$currency}{$amountPaid|crmMoney:$currency}


{ts}AMOUNT DUE:{/ts} {$amountDue|crmMoney:$currency}{ts}AMOUNT DUE:{/ts}{$amountDue|crmMoney:$currency}
{ts 1=$dueDate}DUE DATE: %1{/ts}{ts 1=$dueDate}DUE DATE: %1{/ts}
+ {if $contribution_status_id == $pendingStatusId && $is_pay_later == 1} - +
- +
- + +
- - -
{ts}PAYMENT ADVICE{/ts}

{ts}To: {/ts}
- {$domain_organization}
- {$domain_street_address} {$domain_supplemental_address_1}
- {$domain_supplemental_address_2} {$domain_state}
- {$domain_city} {$domain_postal_code}
- {$domain_country}
- {$domain_phone}
+
{ts}PAYMENT ADVICE{/ts}

{ts}To:{/ts}
+ {$domain_organization}
+ {$domain_street_address} {$domain_supplemental_address_1}
+ {$domain_supplemental_address_2} {$domain_state}
+ {$domain_city} {$domain_postal_code}
+ {$domain_country}
{$domain_email}
-


{$notes} + {$domain_phone}
+

{$notes}
- +
- - - + + - - - + + - + {if $is_pay_later == 1} - - - + + {else} - - - + + {/if} - - - + + - +
{ts}Customer: {/ts}{$display_name}{ts}Customer:{/ts}{$display_name}
{ts}Invoice Number: {/ts}{$invoice_number}{ts}Invoice Number:{/ts}{$invoice_number}


{ts}Amount Due:{/ts}{$amount|crmMoney:$currency}{ts}Amount Due:{/ts}{$amount|crmMoney:$currency}
{ts}Amount Due: {/ts}{$amountDue|crmMoney:$currency}{ts}Amount Due:{/ts}{$amountDue|crmMoney:$currency}
{ts}Due Date: {/ts}{$dueDate}{ts}Due Date:{/ts}{$dueDate}


-
{/if} {if $contribution_status_id == $refundedStatusId || $contribution_status_id == $cancelledStatusId} - + {if $config->empoweredBy} +
- +
-
+ {/if} - +
+
- - - - + + + {if $organization_name} - + {else} - + {/if} - - + - - - + + - - - + + - - - + + - - + -
{ts}CREDIT NOTE{/ts}{ts}Date:{/ts}{$domain_organization}{ts}CREDIT NOTE{/ts}{ts}Date:{/ts}{$domain_organization}
{$display_name} ({$organization_name}){$display_name} ({$organization_name}){$display_name}{$display_name}{$invoice_date}{$invoice_date} - + {if $domain_street_address }{$domain_street_address}{/if} {if $domain_supplemental_address_1 }{$domain_supplemental_address_1}{/if} - +
{$street_address} {$supplemental_address_1}{ts}Credit Note Number:{/ts}{$street_address} {$supplemental_address_1}{ts}Credit Note Number:{/ts} - + {if $domain_supplemental_address_2 }{$domain_supplemental_address_2}{/if} {if $domain_state }{$domain_state}{/if} - +
{$supplemental_address_2} {$stateProvinceAbbreviation}{$creditnote_id}{$supplemental_address_2} {$stateProvinceAbbreviation}{$creditnote_id} - + {if $domain_city}{$domain_city}{/if} {if $domain_postal_code }{$domain_postal_code}{/if} - +
{$city} {$postal_code}{ts}Reference:{/ts}{$city} {$postal_code}{ts}Reference:{/ts} - + {if $domain_country}{$domain_country}{/if} - +
{$source}{$source} - - {if $domain_phone}{$domain_phone}{/if} - + + {if $domain_email}{$domain_email}{/if} +
- - {if $domain_email}{$domain_email}{/if} - + + {if $domain_phone}{$domain_phone}{/if} +
- +
-
+ {* FIXME: style this table so that it looks like the text version (justification, etc.) *} - - - - - + + + + + {foreach from=$lineItem item=value key=priceset name=pricevalue} {if $smarty.foreach.pricevalue.index eq 0} - + {else} - + {/if} - - + + {if $value.tax_amount != ''} - + {else} - + {/if} - + {/foreach} - + - - - + + + - {foreach from = $dataArray item = value key = priceset} + {foreach from=$dataArray item=value key=priceset} - + {if $priceset} - - + + {elseif $priceset == 0} - - + + {/if} {/foreach} - - + + - - - + + + {if $is_pay_later == 0} - - - + + + - - + + - - - - + + + + {/if}


- + - +
{ts}Description{/ts}{ts}Quantity{/ts}{ts}Unit Price{/ts}{$taxTerm} {ts 1=$defaultCurrency}Amount %1{/ts}{ts}Description{/ts}{ts}Quantity{/ts}{ts}Unit Price{/ts}{$taxTerm}{ts 1=$defaultCurrency}Amount %1{/ts}




- + {if $value.html_type eq 'Text'} {$value.label} {else} @@ -353,100 +322,101 @@ {if $value.description}
{$value.description|truncate:30:"..."}
{/if} -
+
{$value.qty} {$value.unit_price|crmMoney:$currency}{$value.qty}{$value.unit_price|crmMoney:$currency} {$value.tax_rate}%{$value.tax_rate}%{ts 1=$taxTerm}No %1{/ts}{ts 1=$taxTerm}No %1{/ts}{$value.subTotal|crmMoney:$currency}{$value.subTotal|crmMoney:$currency}


{ts}Sub Total{/ts} {$subTotal|crmMoney:$currency}{ts}Sub Total{/ts}{$subTotal|crmMoney:$currency}
{ts 1=$taxTerm 2=$priceset}TOTAL %1 %2%{/ts}{$value|crmMoney:$currency} {ts 1=$taxTerm 2=$priceset}TOTAL %1 %2%{/ts}{$value|crmMoney:$currency} {ts 1=$taxTerm}TOTAL NO %1{/ts}{$value|crmMoney:$currency} {ts 1=$taxTerm}TOTAL NO %1{/ts}{$value|crmMoney:$currency}


{ts 1=$defaultCurrency}TOTAL %1{/ts}{$amount|crmMoney:$currency}{ts 1=$defaultCurrency}TOTAL %1{/ts}{$amount|crmMoney:$currency}
{ts}LESS Credit to invoice(s){/ts}{$amount|crmMoney:$currency}{ts}LESS Credit to invoice(s){/ts}{$amount|crmMoney:$currency}


{ts}REMAINING CREDIT{/ts}{$amountDue|crmMoney:$currency}{ts}REMAINING CREDIT{/ts}{$amountDue|crmMoney:$currency}
- + +
- +
- +
- + @@ -454,5 +424,7 @@
{ts}CREDIT ADVICE{/ts}

{ts}Please do not pay on this advice. Deduct the amount of this Credit Note from your next payment to us{/ts}

{ts}CREDIT ADVICE{/ts}

{ts}Please do not pay on this advice. Deduct the amount of this Credit Note from your next payment to us{/ts}

- +
- - - + + + - - - + + + - + - - - + + +
{ts}Customer:{/ts} {$display_name}{ts}Customer:{/ts}{$display_name}
{ts}Credit Note#:{/ts} {$creditnote_id}{ts}Credit Note#:{/ts}{$creditnote_id}


{ts}Credit Amount:{/ts}{$amount|crmMoney:$currency}{ts}Credit Amount:{/ts}{$amount|crmMoney:$currency}
{/if}
+ + -- 2.25.1