dev/core#1776 Ensure that all fee financial item transaction date is set to the recie...
authorSeamus Lee <seamuslee001@gmail.com>
Mon, 25 May 2020 10:44:03 +0000 (20:44 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Sat, 30 May 2020 06:03:17 +0000 (16:03 +1000)
CRM/Core/BAO/FinancialTrxn.php
tests/phpunit/api/v3/ContributionTest.php

index f3c242da19f318724f959037693f25d16d900094..e4aeae7bd23d41900fdbc47d1dc39bb60af8e00a 100644 (file)
@@ -417,7 +417,7 @@ WHERE ceft.entity_id = %1";
         'financial_account_id' => $financialAccount,
         'contact_id' => CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Domain', CRM_Core_Config::domainID(), 'contact_id'),
         'created_date' => date('YmdHis'),
-        'transaction_date' => date('YmdHis'),
+        'transaction_date' => $params['trxnParams']['trxn_date'],
         'amount' => $amount,
         'description' => 'Fee',
         'status_id' => CRM_Core_PseudoConstant::getKey('CRM_Financial_BAO_FinancialItem', 'status_id', 'Paid'),
index cceecd738e66fe4be63a7e1efacf89dc4a153c89..bbc36f10a51d003f064106147b8e8828d9f8efa3 100644 (file)
@@ -518,6 +518,10 @@ class api_v3_ContributionTest extends CiviUnitTestCase {
     ];
 
     $contribution = $this->callAPISuccess('contribution', 'create', $params);
+    $financialItems = $this->callAPISuccess('FinancialItem', 'get', []);
+    foreach ($financialItems['values'] as $financialItem) {
+      $this->assertEquals(date('Y-m-d H:i:s', strtotime($contribution['values'][$contribution['id']]['receive_date'])), date('Y-m-d H:i:s', strtotime($financialItem['transaction_date'])));
+    }
     $lineItems = $this->callAPISuccess('line_item', 'get', [
       'entity_id' => $contribution['id'],
       'entity_table' => 'civicrm_contribution',