本文整理汇总了PHP中CRM_Core_Payment_BaseIPN::sendMail方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_Payment_BaseIPN::sendMail方法的具体用法?PHP CRM_Core_Payment_BaseIPN::sendMail怎么用?PHP CRM_Core_Payment_BaseIPN::sendMail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_Payment_BaseIPN
的用法示例。
在下文中一共展示了CRM_Core_Payment_BaseIPN::sendMail方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testsendMailPledge
/**
* Test the LoadObjects function with a pledge.
*/
public function testsendMailPledge()
{
$this->_setUpPledgeObjects();
$values = array();
$this->IPN->loadObjects($this->input, $this->ids, $this->objects, FALSE, NULL);
$msg = $this->IPN->sendMail($this->input, $this->ids, $this->objects, $values, FALSE, TRUE);
$this->assertContains('Contribution Information', $msg['html']);
}
示例2: postProcess
/**
* process the form after the input has been submitted and validated
*
* @access public
*
* @return void
*/
public function postProcess()
{
// get all the details needed to generate a receipt
$contribIDs = implode(',', $this->_contributionIds);
$details = CRM_Contribute_Form_Task_Status::getDetails($contribIDs);
$baseIPN = new CRM_Core_Payment_BaseIPN();
$message = array();
$template = CRM_Core_Smarty::singleton();
$params = $this->controller->exportValues($this->_name);
$createPdf = FALSE;
if ($params['output'] == "pdf_receipt") {
$createPdf = TRUE;
}
$excludeContactIds = array();
if (!$createPdf) {
$returnProperties = array('email' => 1, 'do_not_email' => 1, 'is_deceased' => 1, 'on_hold' => 1);
list($contactDetails) = CRM_Utils_Token::getTokenDetails($this->_contactIds, $returnProperties, FALSE, FALSE);
$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++;
$excludeContactIds[] = $values['contact_id'];
}
}
}
foreach ($details as $contribID => $detail) {
$input = $ids = $objects = array();
if (in_array($detail['contact'], $excludeContactIds)) {
continue;
}
$input['component'] = $detail['component'];
$ids['contact'] = $detail['contact'];
$ids['contribution'] = $contribID;
$ids['contributionRecur'] = NULL;
$ids['contributionPage'] = NULL;
$ids['membership'] = CRM_Utils_Array::value('membership', $detail);
$ids['participant'] = CRM_Utils_Array::value('participant', $detail);
$ids['event'] = CRM_Utils_Array::value('event', $detail);
if (!$baseIPN->validateData($input, $ids, $objects, FALSE)) {
CRM_Core_Error::fatal();
}
$contribution =& $objects['contribution'];
// CRM_Core_Error::debug('o',$objects);
// set some fake input values so we can reuse IPN code
$input['amount'] = $contribution->total_amount;
$input['is_test'] = $contribution->is_test;
$input['fee_amount'] = $contribution->fee_amount;
$input['net_amount'] = $contribution->net_amount;
$input['trxn_id'] = $contribution->trxn_id;
$input['trxn_date'] = isset($contribution->trxn_date) ? $contribution->trxn_date : NULL;
// CRM_Contribute_BAO_Contribution::composeMessageArray expects mysql formatted date
$objects['contribution']->receive_date = CRM_Utils_Date::isoToMysql($objects['contribution']->receive_date);
// CRM_Core_Error::debug('input',$input);
$values = array();
$mail = $baseIPN->sendMail($input, $ids, $objects, $values, FALSE, $createPdf);
if ($mail['html']) {
$message[] = $mail['html'];
} else {
$message[] = nl2br($mail['body']);
}
// reset template values before processing next transactions
$template->clearTemplateVars();
}
if ($createPdf) {
CRM_Utils_PDF_Utils::html2pdf($message, 'civicrmContributionReceipt.pdf', FALSE, $params['pdf_format_id']);
CRM_Utils_System::civiExit();
} else {
if ($suppressedEmails) {
$status = ts('Email was NOT sent to %1 contacts (no email address on file, or communication preferences specify DO NOT EMAIL, or contact is deceased).', array(1 => $suppressedEmails));
$msgTitle = ts('Email Error');
$msgType = 'error';
} else {
$status = ts('Your mail has been sent.');
$msgTitle = ts('Sent');
$msgType = 'success';
}
CRM_Core_Session::setStatus($status, $msgTitle, $msgType);
}
}
示例3: postProcess
/**
* process the form after the input has been submitted and validated
*
* @access public
* @return None
*/
public function postProcess()
{
// get all the details needed to generate a receipt
$contribIDs = implode(',', $this->_contributionIds);
require_once 'CRM/Contribute/Form/Task/Status.php';
$details =& CRM_Contribute_Form_Task_Status::getDetails($contribIDs);
require_once 'CRM/Core/Payment/BaseIPN.php';
$baseIPN = new CRM_Core_Payment_BaseIPN();
$message = array();
$template =& CRM_Core_Smarty::singleton();
foreach ($details as $contribID => $detail) {
$input = $ids = $objects = array();
$input['component'] = $detail['component'];
$ids['contact'] = $detail['contact'];
$ids['contribution'] = $contribID;
$ids['contributionRecur'] = null;
$ids['contributionPage'] = null;
$ids['membership'] = $detail['membership'];
$ids['participant'] = $detail['participant'];
$ids['event'] = $detail['event'];
if (!$baseIPN->validateData($input, $ids, $objects, false)) {
CRM_Core_Error::fatal();
}
$contribution =& $objects['contribution'];
// CRM_Core_Error::debug('o',$objects);
// set some fake input values so we can reuse IPN code
$input['amount'] = $contribution->total_amount;
$input['is_test'] = $contribution->is_test;
$input['fee_amount'] = $contribution->fee_amount;
$input['net_amount'] = $contribution->net_amount;
$input['trxn_id'] = $contribution->trxn_id;
$input['trxn_date'] = isset($contribution->trxn_date) ? $contribution->trxn_date : null;
// CRM_Core_Error::debug('input',$input);
$values = array();
$mail = $baseIPN->sendMail($input, $ids, $objects, $values, false, true);
$mail = str_replace("\n\n", "<p>", $mail);
$mail = str_replace("\n", "<br/>", $mail);
$message[] = $mail;
// reset template values before processing next transactions
$template->clearTemplateVars();
}
require_once 'CRM/Utils/PDF/Utils.php';
CRM_Utils_PDF_Utils::domlib($message, "civicrmContributionReceipt.pdf");
exit;
}
示例4: postProcess
/**
* process the form after the input has been submitted and validated
*
* @access public
* @return None
*/
public function postProcess()
{
// get all the details needed to generate a receipt
$contribIDs = implode(',', $this->_contributionIds);
require_once 'CRM/Contribute/Form/Task/Status.php';
$details =& CRM_Contribute_Form_Task_Status::getDetails($contribIDs);
require_once 'CRM/Core/Payment/BaseIPN.php';
$baseIPN = new CRM_Core_Payment_BaseIPN();
$message = array();
$template = CRM_Core_Smarty::singleton();
$params = $this->controller->exportValues($this->_name);
$createPdf = false;
if ($params['output'] == "pdf_receipt") {
$createPdf = true;
}
$excludeContactIds = array();
if (!$createPdf) {
$returnProperties = array('email' => 1, 'do_not_email' => 1, 'is_deceased' => 1, 'on_hold' => 1);
require_once 'CRM/Mailing/BAO/Mailing.php';
list($contactDetails) = CRM_Mailing_BAO_Mailing::getDetails($this->_contactIds, $returnProperties, false, false);
foreach ($contactDetails as $id => $values) {
if (empty($values['email']) || CRM_Utils_Array::value('do_not_email', $values) || CRM_Utils_Array::value('is_deceased', $values) || CRM_Utils_Array::value('on_hold', $values)) {
$suppressedEmails++;
$excludeContactIds[] = $values['contact_id'];
}
}
}
foreach ($details as $contribID => $detail) {
$input = $ids = $objects = array();
if (in_array($detail['contact'], $excludeContactIds)) {
continue;
}
$input['component'] = $detail['component'];
$ids['contact'] = $detail['contact'];
$ids['contribution'] = $contribID;
$ids['contributionRecur'] = null;
$ids['contributionPage'] = null;
$ids['membership'] = $detail['membership'];
$ids['participant'] = $detail['participant'];
$ids['event'] = $detail['event'];
if (!$baseIPN->validateData($input, $ids, $objects, false)) {
CRM_Core_Error::fatal();
}
$contribution =& $objects['contribution'];
// CRM_Core_Error::debug('o',$objects);
// set some fake input values so we can reuse IPN code
$input['amount'] = $contribution->total_amount;
$input['is_test'] = $contribution->is_test;
$input['fee_amount'] = $contribution->fee_amount;
$input['net_amount'] = $contribution->net_amount;
$input['trxn_id'] = $contribution->trxn_id;
$input['trxn_date'] = isset($contribution->trxn_date) ? $contribution->trxn_date : null;
// CRM_Core_Error::debug('input',$input);
$values = array();
$mail = $baseIPN->sendMail($input, $ids, $objects, $values, false, $createPdf);
if (!$mail['html']) {
$mail = str_replace("\n\n", "<p>", $mail);
$mail = str_replace("\n", "<br/>", $mail);
}
$message[] = $mail;
// reset template values before processing next transactions
$template->clearTemplateVars();
}
if ($createPdf) {
require_once 'CRM/Utils/PDF/Utils.php';
CRM_Utils_PDF_Utils::domlib($message, 'civicrmContributionReceipt.pdf', false, 'portrait', 'letter');
CRM_Utils_System::civiExit();
} else {
if ($suppressedEmails) {
$status = array('', ts('Email was NOT sent to %1 contacts (no email address on file, or communication preferences specify DO NOT EMAIL, or contact is deceased).', array(1 => $suppressedEmails)));
} else {
$status = array('', ts('Your mail has been sent.'));
}
CRM_Core_Session::setStatus($status);
}
}