From: Web Access Date: Tue, 19 Jan 2016 12:58:57 +0000 (+0530) Subject: Additional fix for CRM-17815 and alignment fixes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=def7e7707dd4a1730c97dff8f92d4441e7af4dd5;p=civicrm-core.git Additional fix for CRM-17815 and alignment fixes --- diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 9bc685129e..617033da66 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -4046,7 +4046,7 @@ WHERE con.id = {$contributionId} empty($params['skipLineItem']) && !$isLineItem ) { $taxRateParams = $taxRates[$params['financial_type_id']]; - $taxAmount = CRM_Contribute_BAO_Contribution_Utils::calculateTaxAmount($params['total_amount'], $taxRateParams); + $taxAmount = CRM_Contribute_BAO_Contribution_Utils::calculateTaxAmount(CRM_Utils_Array::value('total_amount', $params), $taxRateParams); $params['tax_amount'] = round($taxAmount['tax_amount'], 2); // Get Line Item on update of contribution @@ -4061,7 +4061,7 @@ WHERE con.id = {$contributionId} $params['line_item'][$setID][$priceFieldID]['tax_amount'] = $params['tax_amount']; } } - $params['total_amount'] = $params['total_amount'] + $params['tax_amount']; + $params['total_amount'] = CRM_Utils_Array::value('total_amount', $params) + $params['tax_amount']; } elseif (isset($params['api.line_item.create'])) { // Update total amount of contribution using lineItem diff --git a/xml/templates/message_templates/contribution_invoice_receipt_html.tpl b/xml/templates/message_templates/contribution_invoice_receipt_html.tpl index 16064ca53c..66c222b70e 100644 --- a/xml/templates/message_templates/contribution_invoice_receipt_html.tpl +++ b/xml/templates/message_templates/contribution_invoice_receipt_html.tpl @@ -12,70 +12,70 @@
- - + + - + - {if $organization_name} - - {else} - - {/if} - - - - + {if $organization_name} + + {else} + + {/if} + + + + - + - - - + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + +
{ts}INVOICE{/ts}
{ts}INVOICE{/ts} {ts}Invoice Date:{/ts} {$domain_organization}
{$display_name} ({$organization_name}){$display_name}{$invoice_date} - {if $domain_street_address } - {$domain_street_address} - {/if} - {if $domain_supplemental_address_1 }{$domain_supplemental_address_1}{/if}
{$display_name} ({$organization_name}){$display_name}{$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}{if $domain_supplemental_address_2 }{$domain_supplemental_address_2}{/if} - {if $domain_state }{$domain_state}{/if} + + {if $domain_supplemental_address_2 }{$domain_supplemental_address_2}{/if} + {if $domain_state }{$domain_state}{/if} + +
{$supplemental_address_2} {$stateProvinceAbbreviation} {$invoice_id}{if $domain_city} - {$domain_city} - {/if} - {if $domain_postal_code } - {$domain_postal_code} - {/if} -
+ + {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}
{$source} {if $domain_phone}{$domain_phone}{/if}
{if $domain_email} - {$domain_email} - {/if}
{ts}Reference:{/ts} {if $domain_country}{$domain_country}{/if}
{$source} {if $domain_phone}{$domain_phone}{/if}
{if $domain_email}{$domain_email}{/if}
- +
{* FIXME: style this table so that it looks like the text version (justification, etc.) *} @@ -86,232 +86,246 @@ {foreach from=$lineItem item=value key=priceset name=taxpricevalue} - {if $smarty.foreach.taxpricevalue.index eq 0} - - {else} - - {/if} + {if $smarty.foreach.taxpricevalue.index eq 0} + + + + {else} + + + + {/if} - - - {if $value.tax_amount != ''} - + {if $value.html_type eq 'Text'} + {$value.label} {else} - - {/if} - - + {$value.field_title} - {$value.label} + {/if} + {if $value.description} +
{$value.description|truncate:30:"..."}
+ {/if} + + + + + {if $value.tax_amount != ''} + + {else} + + {/if} + + {/foreach} - - - - - - - {foreach from = $dataArray item = value key = priceset} - - - {if $priceset} - - + + + + + + + {foreach from = $dataArray item = value key = priceset} + + + {if $priceset} + + {elseif $priceset == 0} - - {/if} - {/foreach} - - - - - - - - - - - - {if $is_pay_later == 0} - - - - - - - - - - - - - - - {/if} -


- - - - {if $contribution_status_id == $pendingStatusId && $is_pay_later == 1} - - - - - {/if} + + {/if} + {/foreach} + + + + + + + + + + {if $is_pay_later == 0} + + + + + + + + + + + + + + + + {/if} +


+ + + + {if $contribution_status_id == $pendingStatusId && $is_pay_later == 1} + + + + + {/if}
{ts 1=$defaultCurrency}Amount %1{/ts}




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

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

{ts}Sub Total{/ts} {$subTotal|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=$defaultCurrency}TOTAL %1{/ts}{$amount|crmMoney:$currency}
- {if $contribution_status_id == $refundedStatusId} - {ts}LESS Amount Credited{/ts} - {else} - {ts}LESS Amount Paid{/ts} - {/if} - {$amount|crmMoney:$currency}

{ts}AMOUNT DUE:{/ts} {$amountDue|crmMoney:$currency}
{ts 1=$dueDate}DUE DATE: %1{/ts}

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

{ts}AMOUNT DUE:{/ts} {$amountDue|crmMoney:$currency}
{ts 1=$dueDate}DUE DATE: %1{/ts}
- - - - -
- - - - -
{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}
- {$domain_email}
-


{$notes} + {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}
+ {$domain_email}
+


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

+ - - - - {else} - - - - - - {/if} - - - {if $contribution_status_id == $pendingStatusId && $is_pay_later == 1} - - - {/if} - - + + + + + + + + + + {if $is_pay_later == 1} + + + + + + {else} + + + + + + {/if} + + + + + + -
{ts}Amount Due:{/ts}{$amount|crmMoney:$currency}
{ts}Amount Due: {/ts}{$amountDue|crmMoney:$currency}
{ts}Due Date: {/ts}{$dueDate}
{ts}Customer: {/ts}{$display_name}
{ts}Invoice Number: {/ts}{$invoice_id}

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

+
- + + + {/if} {if $contribution_status_id == $refundedStatusId || $contribution_status_id == $cancelledStatusId} - - - - -
+ + + + +
- + - + - {if $organization_name} - - {else} - - {/if} - - - - + {if $organization_name} + + {else} + + {/if} + + + + - + - - - + + + - - - + + + - - - - - - - - + + + + + + + +
{ts}CREDIT NOTE{/ts} {ts}Date:{/ts} {$domain_organization}
{$display_name} ({$organization_name}){$display_name}{$invoice_date} - {if $domain_street_address } - {$domain_street_address} - {/if} - {if $domain_supplemental_address_1 } - {$domain_supplemental_address_1} - {/if}
{$display_name} ({$organization_name}){$display_name}{$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}{if $domain_supplemental_address_2 } - {$domain_supplemental_address_2} - {/if} - {if $domain_state } - {$domain_state} - {/if} - + + {if $domain_supplemental_address_2 }{$domain_supplemental_address_2}{/if} + {if $domain_state }{$domain_state}{/if} + +
{$supplemental_address_2} {$stateProvinceAbbreviation} {$creditnote_id}{if $domain_city} - {$domain_city} - {/if} - {if $domain_postal_code } - {$domain_postal_code} - {/if} -
+ + {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}
+ + {if $domain_country}{$domain_country}{/if} + +
{$source} {if $domain_phone} - {$domain_phone} - {/if}
{if $domain_email} - {$domain_email} - {/if}
+ + {if $domain_phone}{$domain_phone}{/if} + +
+ + {if $domain_email}{$domain_email}{/if} + +
- +
{* FIXME: style this table so that it looks like the text version (justification, etc.) *} @@ -322,116 +336,122 @@ {foreach from=$lineItem item=value key=priceset name=pricevalue} - {if $smarty.foreach.pricevalue.index eq 0} - - {else} - - {/if} + {if $smarty.foreach.pricevalue.index eq 0} + + {else} + + {/if} - - - - {if $value.tax_amount != ''} - - {else} - + + + + {if $value.tax_amount != ''} + + {else} + + {/if} + + + {/foreach} + + + + + + + {foreach from = $dataArray item = value key = priceset} + + + {if $priceset} + + + {elseif $priceset == 0} + + + + {/if} + {/foreach} + + + + + + + + + + {if $is_pay_later == 0} + + + + + + + + + + + + + + + {/if} - - - {/foreach} - - - - - - - {foreach from = $dataArray item = value key = priceset} - - - {if $priceset} - - - {elseif $priceset == 0} - - - - {/if} - {/foreach} - - - - - - - - - - - - {if $is_pay_later == 0} - - - - - - - - - - - - - - - - {/if} -


- - - - - - - +


+ + + + + + +
{ts 1=$defaultCurrency}Amount %1{/ts}




- {if $value.html_type eq 'Text'}{$value.label}{else}{$value.field_title} - {$value.label}{/if} {if $value.description}
{$value.description|truncate:30:"..."}
{/if} -
{$value.qty} {$value.unit_price|crmMoney:$currency} {$value.tax_rate}%{ts 1=$taxTerm}No %1{/ts} + + {if $value.html_type eq 'Text'} + {$value.label} + {else} + {$value.field_title} - {$value.label} + {/if} + {if $value.description} +
{$value.description|truncate:30:"..."}
+ {/if} +
+
{$value.qty} {$value.unit_price|crmMoney:$currency} {$value.tax_rate}%{ts 1=$taxTerm}No %1{/ts}{$value.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}TOTAL NO %1{/ts}{$value|crmMoney:$currency}

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

{ts}REMAINING CREDIT{/ts}{$amountDue|crmMoney:$currency}
{$value.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}TOTAL NO %1{/ts}{$value|crmMoney:$currency}

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

{ts}REMAINING CREDIT{/ts}{$amountDue|crmMoney:$currency}
-
- - - - - -
{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}Credit Note#:{/ts} {$creditnote_id}

{ts}Credit Amount:{/ts}{$amount|crmMoney:$currency}
-
- {/if} + + + + + +
{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}Credit Note#:{/ts} {$creditnote_id}

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