$values['is_email_receipt'] = $recurContrib->is_email_receipt;
}
- if (!empty($values['is_email_receipt'])) {
- $contributionParams['receipt_date'] = $changeDate;
- }
-
if (!empty($memberships)) {
foreach ($memberships as $membershipTypeIdKey => $membership) {
if ($membership) {
$values['receipt_from_name'] = CRM_Utils_Array::value('receipt_from_name', $input, $userName);
}
}
+ // Contribution ID should really always be set. But ?
+ if (!$returnMessageText && (!isset($input['receipt_update']) || $input['receipt_update'])) {
+ civicrm_api3('Contribution', 'create', array('receipt_date' => 'now', 'id' => $contribution->id));
+ }
return $contribution->composeMessageArray($input, $ids, $values, $recur, $returnMessageText);
}
$input['net_amount'] = $contribution->net_amount;
$input['trxn_id'] = $contribution->trxn_id;
$input['trxn_date'] = isset($contribution->trxn_date) ? $contribution->trxn_date : NULL;
- $input['receipt_date'] = $contribution->receipt_date;
+ $input['receipt_update'] = $params['receipt_update'];
// CRM_Contribute_BAO_Contribution::composeMessageArray expects mysql formatted date
$objects['contribution']->receive_date = CRM_Utils_Date::isoToMysql($objects['contribution']->receive_date);
// reset template values before processing next transactions
$template->clearTemplateVars();
- if (!empty($params['receipt_update'])) {
- $objects['contribution']->receipt_date = date('Y-m-d H-i-s');
- $objects['contribution']->save();
- }
}
if ($elements['createPdf']) {
$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']);
+ $contribution = $this->callAPISuccess('contribution', 'getsingle', array('id' => $contribution['id']));
+ $this->assertEquals('Completed', $contribution['contribution_status']);
+ $this->assertEquals(date('Y-m-d'), date('Y-m-d', strtotime($contribution['receipt_date'])));
$mut->checkMailLog(array(
'Receipt - Contribution',
'Please print this confirmation for your records.',