From eb6acea353f03e683576717aa8399292ff19b3b9 Mon Sep 17 00:00:00 2001 From: Jitendra Purohit Date: Thu, 27 Sep 2018 12:42:29 +0530 Subject: [PATCH] dev/core#411 - Default currency shown on View participant and contribution page if payment is made with different currency --- CRM/Contribute/BAO/Contribution.php | 3 ++- templates/CRM/Contribute/Page/PaymentInfo.tpl | 6 ++--- templates/CRM/Price/Page/LineItem.tpl | 22 +++++++++++-------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index ceb09eb5d9..6fda2f758f 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -4115,10 +4115,11 @@ WHERE eft.financial_trxn_id IN ({$trxnId}, {$baseTrxnId['financialTrxnId']}) } $paymentBalance = CRM_Core_BAO_FinancialTrxn::getPartialPaymentWithType($id, $entity, FALSE, $total); - $contribution = civicrm_api3('Contribution', 'getsingle', array('id' => $contributionId, 'return' => array('is_pay_later', 'contribution_status_id', 'financial_type_id'))); + $contribution = civicrm_api3('Contribution', 'getsingle', array('id' => $contributionId, 'return' => array('currency', 'is_pay_later', 'contribution_status_id', 'financial_type_id'))); $info['payLater'] = $contribution['is_pay_later']; $info['contribution_status'] = $contribution['contribution_status']; + $info['currency'] = $contribution['currency']; $financialTypeId = $contribution['financial_type_id']; $feeFinancialAccount = CRM_Contribute_PseudoConstant::getRelationalFinancialAccount($financialTypeId, 'Expense Account is'); diff --git a/templates/CRM/Contribute/Page/PaymentInfo.tpl b/templates/CRM/Contribute/Page/PaymentInfo.tpl index 4c9d8cc1f4..482c22a366 100644 --- a/templates/CRM/Contribute/Page/PaymentInfo.tpl +++ b/templates/CRM/Contribute/Page/PaymentInfo.tpl @@ -61,10 +61,10 @@ CRM.$(function($) { {ts}Balance{/ts} - {$paymentInfo.total|crmMoney} + {$paymentInfo.total|crmMoney:$paymentInfo.currency} {if $paymentInfo.paid > 0} - {$paymentInfo.paid|crmMoney} + {$paymentInfo.paid|crmMoney:$paymentInfo.currency} {if !$hideButtonLinks}
@@ -74,7 +74,7 @@ CRM.$(function($) { {/if} {/if} - {$paymentInfo.balance|crmMoney} + {$paymentInfo.balance|crmMoney:$paymentInfo.currency} {if $paymentInfo.balance and !$paymentInfo.payLater && !$hideButtonLinks} diff --git a/templates/CRM/Price/Page/LineItem.tpl b/templates/CRM/Price/Page/LineItem.tpl index 8fe2f888ad..59d9c0ba1e 100644 --- a/templates/CRM/Price/Page/LineItem.tpl +++ b/templates/CRM/Price/Page/LineItem.tpl @@ -25,6 +25,10 @@ *} {* Displays contribution/event fees when price set is used. *} +{if !$currency && $fee_currency} + {assign var=currency value="$fee_currency"} +{/if} + {foreach from=$lineItem item=value key=priceset} {if $value neq 'skip'} {if $lineItem|@count GT 1} {* Header for multi participant registration cases. *} @@ -68,23 +72,23 @@ {/if} {if $context NEQ "Membership"} {$line.qty} - {$line.unit_price|crmMoney} + {$line.unit_price|crmMoney:$currency} {else} - {$line.line_total|crmMoney} + {$line.line_total|crmMoney:$currency} {/if} {if !$getTaxDetails && $context NEQ "Membership"} - {$line.line_total|crmMoney} + {$line.line_total|crmMoney:$currency} {/if} {if $getTaxDetails} - {$line.line_total|crmMoney} + {$line.line_total|crmMoney:$currency} {if $line.tax_rate != "" || $line.tax_amount != ""} {$taxTerm} ({$line.tax_rate}%) - {$line.tax_amount|crmMoney} + {$line.tax_amount|crmMoney:$currency} {else} {/if} - {$line.line_total+$line.tax_amount|crmMoney} + {$line.line_total+$line.tax_amount|crmMoney:$currency} {/if} {if $pricesetFieldsCount} {$line.participant_count} @@ -98,13 +102,13 @@
{if $getTaxDetails && $totalTaxAmount} - {ts 1=$taxTerm}Total %1 Amount{/ts}: {$totalTaxAmount|crmMoney}
+ {ts 1=$taxTerm}Total %1 Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}
{/if} {if $context EQ "Contribution"} {ts}Contribution Total{/ts}: {elseif $context EQ "Event"} {if $totalTaxAmount} - {ts}Event SubTotal: {$totalAmount-$totalTaxAmount|crmMoney}{/ts}
+ {ts}Event SubTotal: {$totalAmount-$totalTaxAmount|crmMoney:$currency}{/ts}
{/if} {ts}Event Total{/ts}: {elseif $context EQ "Membership"} @@ -112,7 +116,7 @@ {else} {ts}Total Amount{/ts}: {/if} - {$totalAmount|crmMoney} + {$totalAmount|crmMoney:$currency}
-- 2.25.1