$this->add('select', 'pdf_format_id', ts('Page Format'),
array(0 => ts('- default -')) + CRM_Core_BAO_PdfFormat::getList(TRUE)
);
+ $this->add('checkbox', 'receipt_update', ts('Update receipt dates for these contributions'), FALSE);
+ $this->add('checkbox', 'override_privacy', ts('Override privacy setting? (Do no email / Do not mail)'), FALSE);
$this->addButtons(array(
array(
*/
function setDefaultValues() {
$defaultFormat = CRM_Core_BAO_PdfFormat::getDefaultValues();
- return array('pdf_format_id' => $defaultFormat['id']);
+ return array('pdf_format_id' => $defaultFormat['id'], 'receipt_update' => 1, 'override_privacy' => 0);
}
/**
$values = array();
$mail = $elements['baseIPN']->sendMail($input, $ids, $objects, $values, FALSE, $elements['createPdf']);
+
if ($mail['html']) {
$message[] = $mail['html'];
}
// 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']) {
$pdfElements['suppressedEmails'] = 0;
$suppressedEmails = 0;
foreach ($contactDetails as $id => $values) {
- if (empty($values['email']) || !empty($values['do_not_email']) ||
- CRM_Utils_Array::value('is_deceased', $values) || !empty($values['on_hold'])) {
- $suppressedEmails++;
- $pdfElements['suppressedEmails'] = $suppressedEmails;
- $excludeContactIds[] = $values['contact_id'];
+ if (empty($values['email']) ||
+ (empty($params['override_privacy']) && !empty($values['do_not_email']))
+ || CRM_Utils_Array::value('is_deceased', $values)
+ || !empty($values['on_hold'])) {
+ $suppressedEmails++;
+ $pdfElements['suppressedEmails'] = $suppressedEmails;
+ $excludeContactIds[] = $values['contact_id'];
}
}
}