Skip to content

Commit

Permalink
Merge pull request #9405 from jitendrapurohit/CRM-19660
Browse files Browse the repository at this point in the history
CRM-19660: Financial Transaction stores wrong transaction date if the…
  • Loading branch information
eileenmcnaughton authored Nov 22, 2016
2 parents 0569a0a + 0a8160e commit 24992c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -3194,7 +3194,7 @@ public static function recordFinancialAccounts(&$params, $financialTrxnValues =
'payment_instrument_id' => CRM_Utils_Array::value('payment_instrument_id', $params, $params['contribution']->payment_instrument_id),
'check_number' => CRM_Utils_Array::value('check_number', $params),
);
if ($contributionStatus == 'Refunded' || $contributionStatus == 'Chargeback') {
if ($contributionStatus == 'Refunded' || $contributionStatus == 'Chargeback' || $contributionStatus == 'Cancelled') {
$trxnParams['trxn_date'] = !empty($params['contribution']->cancel_date) ? $params['contribution']->cancel_date : date('YmdHis');
if (isset($params['refund_trxn_id'])) {
// CRM-17751 allow a separate trxn_id for the refund to be passed in via api & form.
Expand Down
7 changes: 6 additions & 1 deletion tests/phpunit/api/v3/ContributionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1366,10 +1366,15 @@ public function testCreateUpdateContributionCancelPending() {
$newParams = array_merge($contribParams, array(
'id' => $contribution['id'],
'contribution_status_id' => 3,
'cancel_date' => '2012-02-02 09:00',
)
);
//Check if trxn_date is same as cancel_date.
$checkTrxnDate = array(
'trxn_date' => '2012-02-02 09:00:00',
);
$contribution = $this->callAPISuccess('contribution', 'create', $newParams);
$this->_checkFinancialTrxn($contribution, 'cancelPending');
$this->_checkFinancialTrxn($contribution, 'cancelPending', NULL, $checkTrxnDate);
$this->_checkFinancialItem($contribution['id'], 'cancelPending');
}

Expand Down

0 comments on commit 24992c9

Please sign in to comment.