'title' => ts('Search Results'),
),
);
-
+ CRM_Contact_Form_Task_EmailCommon ::preProcessFromAddress($this);
CRM_Utils_System::appendBreadCrumb($breadCrumb);
CRM_Utils_System::setTitle(ts('Print Contribution Receipts'));
}
public function buildQuickForm() {
$this->addElement('radio', 'output', NULL, ts('Email Receipts'), 'email_receipt',
- array('onClick' => "document.getElementById('selectPdfFormat').style.display = 'none';")
+ array(
+ 'onClick' => "document.getElementById('selectPdfFormat').style.display = 'none';
+ document.getElementById('selectEmailFrom').style.display = 'block';")
);
$this->addElement('radio', 'output', NULL, ts('PDF Receipts'), 'pdf_receipt',
array('onClick' => "document.getElementById('selectPdfFormat').style.display = 'block';")
$this->add('checkbox', 'receipt_update', ts('Update receipt dates for these contributions'), FALSE);
$this->add('checkbox', 'override_privacy', ts('Override privacy setting? (Do not email / Do not mail)'), FALSE);
+ $this->add('select', 'fromEmailAddress', ts('From Email'), $this->_fromEmails, FALSE, array('class' => 'crm-select2 huge'));
+
$this->addButtons(array(
array(
'type' => 'next',
$params = $this->controller->exportValues($this->_name);
$elements = self::getElements($this->_contributionIds, $params, $this->_contactIds);
+ $fromEmail = $params['fromEmailAddress'];
+ $from = CRM_Utils_Array::value($fromEmail, $this->_emails);
+ $fromDetails = explode(' <', $from);
+
foreach ($elements['details'] as $contribID => $detail) {
$input = $ids = $objects = array();
$objects['contribution']->receive_date = CRM_Utils_Date::isoToMysql($objects['contribution']->receive_date);
$values = array();
+ if (isset($params['fromEmailAddress']) && !$elements['createPdf']) {
+ $fromEmail = $params['fromEmailAddress'];
+ $from = CRM_Utils_Array::value($fromEmail, $this->_emails);
+ $fromDetails = explode(' <', $from);
+ $input['receipt_from_email'] = substr(trim($fromDetails[1]), 0, -1);
+ $input['receipt_from_name'] = str_replace('"', '', $fromDetails[0]);
+ }
+
$mail = CRM_Contribute_BAO_Contribution::sendMail($input, $ids, $objects['contribution']->id, $values, FALSE,
$elements['createPdf']);