}
$contact['is_sent'][$groupBy][$groupByID] = TRUE;
}
- // update dates (do it for each contribution including grouped recurring contribution)
- //@todo - the 2 calls below bypass all hooks. Using the api would possibly be slower than one call but not than 2
+ // Update receipt/thankyou dates
+ $contributionParams = array('id' => $contributionId);
if ($receipt_update) {
- $result = CRM_Core_DAO::setFieldValue('CRM_Contribute_DAO_Contribution', $contributionId, 'receipt_date', $nowDate);
- if ($result) {
- $receipts++;
- }
+ $contributionParams['receipt_date'] = $nowDate;
}
if ($thankyou_update) {
- $result = CRM_Core_DAO::setFieldValue('CRM_Contribute_DAO_Contribution', $contributionId, 'thankyou_date', $nowDate);
- if ($result) {
- $thanks++;
- }
+ $contributionParams['thankyou_date'] = $nowDate;
+ }
+ if ($receipt_update || $thankyou_update) {
+ civicrm_api3('Contribution', 'create', $contributionParams);
+ $receipts = ($receipt_update ? $receipts + 1 : $receipts);
+ $thanks = ($thankyou_update ? $thanks + 1 : $thanks);
}
}