Skip to content
Snippets Groups Projects
Commit 46fa5206 authored by Eileen McNaughton's avatar Eileen McNaughton
Browse files

CRM-14151 add hacky-handling to receive date like other date fields in...

CRM-14151 add hacky-handling to receive date like other date fields in completetransaction function to mitigate DAO->find() followed by DAO->save() fatalling on date fields .. sometimes

----------------------------------------
* CRM-14151: BaseIPN fails when receipt_date is set
  http://issues.civicrm.org/jira/browse/CRM-14151
parent faa5d398
No related branches found
No related tags found
No related merge requests found
......@@ -502,6 +502,7 @@ LIMIT 1;";
$contribution->trxn_id = $input['trxn_id'];
$contribution->receive_date = CRM_Utils_Date::isoToMysql($contribution->receive_date);
$contribution->thankyou_date = CRM_Utils_Date::isoToMysql($contribution->thankyou_date);
$contribution->receipt_date = CRM_Utils_Date::isoToMysql($contribution->receipt_date);
$contribution->cancel_date = 'null';
if (CRM_Utils_Array::value('check_number', $input)) {
......
......@@ -1230,6 +1230,31 @@ class api_v3_ContributionTest extends CiviUnitTestCase {
$mut->stop();
}
/**
* CRM-14151
* Test completing a transaction via the API
*
* For wierd caching-y reasons this test performs differently in isolation than with other
* tests.
*/
function testCompleteTransactionWithReceiptDateSet() {
$mut = new CiviMailUtils( $this, true );
$this->createLoggedInUser();
$params = array_merge($this->_params, array('contribution_status_id' => 1,'receipt_date' => 'now'));
$contribution = $this->callAPISuccess('contribution','create', $params);
$apiResult = $this->callAPISuccess('contribution', 'completetransaction', array(
'id' => $contribution['id'],
)
);
$contribution = $this->callAPISuccess('contribution', 'get', array('id' => $contribution['id'], 'sequential' => 1,));
$this->assertEquals('Completed', $contribution['values'][0]['contribution_status']);
$mut->checkMailLog(array(
'Receipt - Contribution',
'Please print this confirmation for your records.',
));
$mut->stop();
}
/**
* Test completing a transaction with an event via the API
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment