From: Eileen McNaughton Date: Tue, 2 Dec 2014 01:14:12 +0000 (+1300) Subject: CRM-15670 Allow overriding of privacy settings & updating of receive_date when sendin... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=107080459eab42d6de8010f37382fa671970dcd5;p=civicrm-core.git CRM-15670 Allow overriding of privacy settings & updating of receive_date when sending receipts from search --- diff --git a/CRM/Contribute/Form/Task/PDF.php b/CRM/Contribute/Form/Task/PDF.php index e3cd688a7d..27302c46d9 100644 --- a/CRM/Contribute/Form/Task/PDF.php +++ b/CRM/Contribute/Form/Task/PDF.php @@ -119,6 +119,8 @@ AND {$this->_componentClause}"; $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( @@ -139,7 +141,7 @@ AND {$this->_componentClause}"; */ 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); } /** @@ -196,6 +198,7 @@ AND {$this->_componentClause}"; $values = array(); $mail = $elements['baseIPN']->sendMail($input, $ids, $objects, $values, FALSE, $elements['createPdf']); + if ($mail['html']) { $message[] = $mail['html']; } @@ -205,6 +208,10 @@ AND {$this->_componentClause}"; // 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']) { @@ -274,11 +281,13 @@ AND {$this->_componentClause}"; $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']; } } } diff --git a/templates/CRM/Contribute/Form/Task/PDF.tpl b/templates/CRM/Contribute/Form/Task/PDF.tpl index 5fbb55fc15..7f03b1b5da 100644 --- a/templates/CRM/Contribute/Form/Task/PDF.tpl +++ b/templates/CRM/Contribute/Form/Task/PDF.tpl @@ -41,6 +41,12 @@ {$form.pdf_format_id.html} {$form.pdf_format_id.label} {help id="id-contribution-receipt" file="CRM/Contact/Form/Task/PDFLetterCommon.hlp"} + + {$form.receipt_update.html} {$form.receipt_update.label} + + + {$form.override_privacy.html} {$form.override_privacy.label} +