Towards deprecating contributionType in favour of financialType
authoreileenmcnaugton <eileen@fuzion.co.nz>
Sun, 21 Feb 2016 23:45:56 +0000 (12:45 +1300)
committereileenmcnaugton <eileen@fuzion.co.nz>
Sun, 21 Feb 2016 23:46:22 +0000 (12:46 +1300)
Make sure financialType is availabel (& preferred). This commit does not attempt to
change any existing templates

CRM/Contribute/BAO/ContributionPage.php
CRM/Event/Form/Participant.php
xml/templates/message_templates/event_offline_receipt_html.tpl
xml/templates/message_templates/event_offline_receipt_text.tpl
xml/templates/message_templates/event_online_receipt_html.tpl
xml/templates/message_templates/event_online_receipt_text.tpl

index 5bbe2a142e7bee2b7fff6dc10c201a57e3d131c3..2e366a74f8a60458aa0dafe3f6b6b0820ce0977c 100644 (file)
@@ -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)) {
index f40e036949676e0b893794a32459861f954d0d41..415249d7858cc658d7cb083d32106cbe4bd01fc4 100644 (file)
@@ -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) {
index 0fea47f064b7f13ebc8c70741d302a4793fba034..f42bcc33fc03817b6dc575e385b46f602caf6680 100644 (file)
         </tr>
        {/if}
 
-       {if $contributionTypeName}
+       {if $financialTypeName}
         <tr>
          <td {$labelStyle}>
           {ts}Financial Type{/ts}
          </td>
          <td {$valueStyle}>
-          {$contributionTypeName}
+          {$financialTypeName}
          </td>
         </tr>
        {/if}
index 1a7daeb2d82ff9a3337a12178bb83c877f4f9c84..678fa7b5b7e7a7cd27edbf96d08dfe118bd38ca7 100644 (file)
 {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}
index 6c72cad20d387079b1a9ad715946becb208ad0a3..90d93bb5fbab9b2a793cc304db026e096a25a247 100644 (file)
         </tr>
        {/if}
 
-       {if $contributionTypeName}
+       {if $financialTypeName}
         <tr>
          <td {$labelStyle}>
           {ts}Financial Type{/ts}
          </td>
          <td {$valueStyle}>
-          {$contributionTypeName}
+          {$financialTypeName}
          </td>
         </tr>
        {/if}
index ba5703c2a4ee337307b2aabf57b85090bdeb1e84..e5a9c23f22b36109c8158c6661ab52cd386f396e 100644 (file)
@@ -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}