$template->assign('receive_date',
CRM_Utils_Date::processDate($this->receive_date)
);
+ $values['receipt_date'] = (empty($this->receipt_date) ? NULL : $this->receipt_date);
$template->assign('contributeMode', 'notify');
$template->assign('action', $this->is_test ? 1024 : 1);
$template->assign('receipt_text',
$values['receipt_from_name'] = CRM_Utils_Array::value('receipt_from_name', $input, $userName);
}
}
+
+ $return = $contribution->composeMessageArray($input, $ids, $values, $recur, $returnMessageText);
// Contribution ID should really always be set. But ?
- if (!$returnMessageText && (!isset($input['receipt_update']) || $input['receipt_update'])) {
+ if (!$returnMessageText && (!isset($input['receipt_update']) || $input['receipt_update']) && empty($contribution->receipt_date)) {
civicrm_api3('Contribution', 'create', array('receipt_date' => 'now', 'id' => $contribution->id));
- $values['receipt_date'] = date('Y-m-d H:i:s');
}
- return $contribution->composeMessageArray($input, $ids, $values, $recur, $returnMessageText);
+ return $return;
}
/**
'membership_assign' => $values['membership_assign'],
'amount' => $values['amount'],
'is_pay_later' => $values['is_pay_later'],
- 'receipt_date' => !$values['receipt_date'] ?: date('YmdHis', strtotime($values['receipt_date'])),
+ 'receipt_date' => !$values['receipt_date'] ? NULL : date('YmdHis', strtotime($values['receipt_date'])),
);
if ($contributionTypeId = CRM_Utils_Array::value('financial_type_id', $values)) {
'amount:::100.00',
'currency:::USD',
'receive_date:::' . date('Ymd', strtotime($contribution['receive_date'])),
- 'receipt_date:::' . date('Ymd'),
+ "receipt_date:::\n",
'contributeMode:::notify',
'title:::Contribution',
'displayName:::Mr. Anthony Anderson II',
'location_type_id' => 2,
'contact_id' => $this->_params['contact_id'],
));
- $params = array_merge($this->_params, array('contribution_status_id' => 2,
+ $params = array_merge($this->_params, array(
+ 'contribution_status_id' => 2,
'address_id' => $address['id'],
)
);
* CRM-14151 - Test completing a transaction via the API.
*/
public function testCompleteTransactionWithReceiptDateSet() {
+ $this->swapMessageTemplateForTestTemplate();
$mut = new CiviMailUtils($this, TRUE);
$this->createLoggedInUser();
$params = array_merge($this->_params, array('contribution_status_id' => 2, 'receipt_date' => 'now'));
$this->assertEquals(date('Y-m-d'), date('Y-m-d', strtotime($contribution['values'][0]['receive_date'])));
$mut->checkMailLog(array(
'Receipt - Contribution',
- 'Please print this confirmation for your records.',
+ 'receipt_date:::' . date('Ymd'),
));
$mut->stop();
+ $this->revertTemplateToReservedTemplate();
}
$mut->checkMailLog(array(
'amount:::500.00',
'receive_date:::20130201000000',
- 'receipt_date:::201',
+ "receipt_date:::\n",
));
$mut->stop();
$this->revertTemplateToReservedTemplate();