--CRM-20585, fixed financial trxn entry for deferred revenue
authorPradeep Nayak <pradpnayak@gmail.com>
Wed, 17 May 2017 01:23:52 +0000 (06:53 +0530)
committerPradeep Nayak <pradpnayak@gmail.com>
Sat, 20 May 2017 18:44:49 +0000 (00:14 +0530)
CRM-20585, fixed jenkins style

----------------------------------------
* CRM-20585: Correct the from and to accounts for deferred revenue transactions
  https://issues.civicrm.org/jira/browse/CRM-20585

CRM/Core/BAO/FinancialTrxn.php
tests/phpunit/CRM/Contribute/BAO/ContributionTest.php

index 31e04c38d3d0f1d06568cce90a642beab434515b..d09ac055180bce50eb42607fcfc115f250ca15c7 100644 (file)
@@ -685,10 +685,10 @@ WHERE ft.to_financial_account_id NOT IN ( " . implode(', ', $filteredFinancialAc
         }
         foreach ($results['values'] as $result) {
           if ($result['account_relationship'] == $accountRel) {
-            $trxnParams['to_financial_account_id'] = $result['financial_account_id'];
+            $trxnParams['from_financial_account_id'] = $result['financial_account_id'];
           }
           else {
-            $trxnParams['from_financial_account_id'] = $result['financial_account_id'];
+            $trxnParams['to_financial_account_id'] = $result['financial_account_id'];
           }
         }
         foreach ($deferredRevenue['revenue'] as $revenue) {
index e485c85e83336da27b7a2e32486a57467469653b..c2ca619c11e0e16eb6638edc433c2c496bd6c7c5 100644 (file)
@@ -1275,7 +1275,7 @@ WHERE eft.entity_id = %1 AND ft.to_financial_account_id <> %2";
     $checkAgainst = array(
       'financial_trxn_id.to_financial_account_id.name' => 'Deferred Revenue - Event Fee',
       'financial_trxn_id.from_financial_account_id.name' => 'Event Fee',
-      'financial_trxn_id' => '2'
+      'financial_trxn_id' => '2',
     );
     $result = $this->callAPISuccessGetSingle('EntityFinancialTrxn', array(
       'return' => array(