From b956b310c36b7f24acfcafefb7646c02bf49a186 Mon Sep 17 00:00:00 2001 From: eileenmcnaugton Date: Mon, 22 Feb 2016 12:45:56 +1300 Subject: [PATCH] Towards deprecating contributionType in favour of financialType Make sure financialType is availabel (& preferred). This commit does not attempt to change any existing templates --- CRM/Contribute/BAO/ContributionPage.php | 7 +++++-- CRM/Event/Form/Participant.php | 3 +++ .../message_templates/event_offline_receipt_html.tpl | 4 ++-- .../message_templates/event_offline_receipt_text.tpl | 4 ++-- .../message_templates/event_online_receipt_html.tpl | 4 ++-- .../message_templates/event_online_receipt_text.tpl | 4 ++-- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/CRM/Contribute/BAO/ContributionPage.php b/CRM/Contribute/BAO/ContributionPage.php index 5bbe2a142e..2e366a74f8 100644 --- a/CRM/Contribute/BAO/ContributionPage.php +++ b/CRM/Contribute/BAO/ContributionPage.php @@ -383,9 +383,12 @@ class CRM_Contribute_BAO_ContributionPage extends CRM_Contribute_DAO_Contributio ); if ($contributionTypeId = CRM_Utils_Array::value('financial_type_id', $values)) { - $tplParams['contributionTypeId'] = $contributionTypeId; - $tplParams['contributionTypeName'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', + $tplParams['financialTypeId'] = $contributionTypeId; + $tplParams['financialTypeName'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $contributionTypeId); + // Legacy support + $tplParams['contributionTypeName'] = $tplParams['financialTypeName']; + $tplParams['contributionTypeId'] = $contributionTypeId; } if ($contributionPageId = CRM_Utils_Array::value('id', $values)) { diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index f40e036949..415249d785 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -1346,6 +1346,9 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment } //insert financial type name in receipt. + $this->assign('financialTypeName', CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', + $contributionParams['financial_type_id'])); + // legacy support $this->assign('contributionTypeName', CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialType', $contributionParams['financial_type_id'])); $contributionParams['skipLineItem'] = 1; if ($this->_id) { diff --git a/xml/templates/message_templates/event_offline_receipt_html.tpl b/xml/templates/message_templates/event_offline_receipt_html.tpl index 0fea47f064..f42bcc33fc 100644 --- a/xml/templates/message_templates/event_offline_receipt_html.tpl +++ b/xml/templates/message_templates/event_offline_receipt_html.tpl @@ -346,13 +346,13 @@ {/if} - {if $contributionTypeName} + {if $financialTypeName} {ts}Financial Type{/ts} - {$contributionTypeName} + {$financialTypeName} {/if} diff --git a/xml/templates/message_templates/event_offline_receipt_text.tpl b/xml/templates/message_templates/event_offline_receipt_text.tpl index 1a7daeb2d8..678fa7b5b7 100644 --- a/xml/templates/message_templates/event_offline_receipt_text.tpl +++ b/xml/templates/message_templates/event_offline_receipt_text.tpl @@ -195,8 +195,8 @@ {if $receive_date} {ts}Transaction Date{/ts}: {$receive_date|crmDate} {/if} -{if $contributionTypeName} -{ts}Financial Type{/ts}: {$contributionTypeName} +{if $financialTypeName} +{ts}Financial Type{/ts}: {$financialTypeName} {/if} {if $trxn_id} {ts}Transaction #{/ts}: {$trxn_id} diff --git a/xml/templates/message_templates/event_online_receipt_html.tpl b/xml/templates/message_templates/event_online_receipt_html.tpl index 6c72cad20d..90d93bb5fb 100644 --- a/xml/templates/message_templates/event_online_receipt_html.tpl +++ b/xml/templates/message_templates/event_online_receipt_html.tpl @@ -366,13 +366,13 @@ {/if} - {if $contributionTypeName} + {if $financialTypeName} {ts}Financial Type{/ts} - {$contributionTypeName} + {$financialTypeName} {/if} diff --git a/xml/templates/message_templates/event_online_receipt_text.tpl b/xml/templates/message_templates/event_online_receipt_text.tpl index ba5703c2a4..e5a9c23f22 100644 --- a/xml/templates/message_templates/event_online_receipt_text.tpl +++ b/xml/templates/message_templates/event_online_receipt_text.tpl @@ -201,8 +201,8 @@ You were registered by: {$payer.name} {if $receive_date} {ts}Transaction Date{/ts}: {$receive_date|crmDate} {/if} -{if $contributionTypeName} -{ts}Financial Type{/ts}: {$contributionTypeName} +{if $financialTypeName} +{ts}Financial Type{/ts}: {$financialTypeName} {/if} {if $trxn_id} {ts}Transaction #{/ts}: {$trxn_id} -- 2.25.1