本文整理汇总了PHP中CRM_Event_BAO_Event::sendMail方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Event_BAO_Event::sendMail方法的具体用法?PHP CRM_Event_BAO_Event::sendMail怎么用?PHP CRM_Event_BAO_Event::sendMail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Event_BAO_Event
的用法示例。
在下文中一共展示了CRM_Event_BAO_Event::sendMail方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: registerParticipant
/**
* @param array $params
* @param $participant
* @param $event
*
* @return mixed
*/
public function registerParticipant($params, &$participant, $event)
{
$transaction = new CRM_Core_Transaction();
// handle register date CRM-4320
$registerDate = date('YmdHis');
$participantParams = array('id' => $participant->id, 'event_id' => $event->id, 'register_date' => $registerDate, 'source' => CRM_Utils_Array::value('participant_source', $params, $this->description), 'is_pay_later' => $this->is_pay_later, 'fee_amount' => CRM_Utils_Array::value('amount', $params, 0), 'fee_currency' => CRM_Utils_Array::value('currencyID', $params));
if ($participant->must_wait) {
$participant_status = 'On waitlist';
} elseif (CRM_Utils_Array::value('is_pay_later', $params, FALSE)) {
$participant_status = 'Pending from pay later';
} else {
$participant_status = 'Registered';
}
$participant_statuses = CRM_Event_PseudoConstant::participantStatus();
$participantParams['status_id'] = array_search($participant_status, $participant_statuses);
$participant_status_label = CRM_Utils_Array::value($participantParams['status_id'], CRM_Event_PseudoConstant::participantStatus(NULL, NULL, 'label'));
$participantParams['participant_status'] = $participant_status_label;
$this->assign('isOnWaitlist', $participant->must_wait);
if ($this->_action & CRM_Core_Action::PREVIEW || CRM_Utils_Array::value('mode', $params) == 'test') {
$participantParams['is_test'] = 1;
} else {
$participantParams['is_test'] = 0;
}
if (self::is_administrator()) {
if (!empty($params['note'])) {
$note_params = array('participant_id' => $participant->id, 'contact_id' => self::getContactID(), 'note' => $params['note']);
CRM_Event_BAO_Participant::update_note($note_params);
}
}
$participant->copyValues($participantParams);
$participant->save();
if (!empty($params['contributionID'])) {
$payment_params = array('participant_id' => $participant->id, 'contribution_id' => $params['contributionID']);
$ids = array();
$paymentParticpant = CRM_Event_BAO_ParticipantPayment::create($payment_params, $ids);
}
$transaction->commit();
$event_values = array();
CRM_Core_DAO::storeValues($event, $event_values);
$location = array();
if (CRM_Utils_Array::value('is_show_location', $event_values) == 1) {
$locationParams = array('entity_id' => $participant->event_id, 'entity_table' => 'civicrm_event');
$location = CRM_Core_BAO_Location::getValues($locationParams, TRUE);
CRM_Core_BAO_Address::fixAddress($location['address'][1]);
}
list($pre_id, $post_id) = CRM_Event_Cart_Form_MerParticipant::get_profile_groups($participant->event_id);
$payer_values = array('email' => '', 'name' => '');
if ($this->payer_contact_id) {
$payer_contact_details = CRM_Contact_BAO_Contact::getContactDetails($this->payer_contact_id);
$payer_values = array('email' => $payer_contact_details[1], 'name' => $payer_contact_details[0]);
}
$values = array('params' => array($participant->id => $participantParams), 'event' => $event_values, 'location' => $location, 'custom_pre_id' => $pre_id, 'custom_post_id' => $post_id, 'payer' => $payer_values);
CRM_Event_BAO_Event::sendMail($participant->contact_id, $values, $participant->id);
return $participant;
}
示例2: processRegistration
//.........这里部分代码省略.........
if ($participantEmail) {
$this->_participantInfo[] = $participantEmail;
} else {
$this->_participantInfo[] = $value['first_name'] . ' ' . $value['last_name'];
}
} elseif (!empty($value['contact_id'])) {
$contactID = $value['contact_id'];
} else {
$contactID = $this->getContactID();
}
CRM_Event_Form_Registration_Confirm::fixLocationFields($value, $fields, $this);
//for free event or additional participant, dont create billing email address.
if (empty($value['is_primary']) || !$this->_values['event']['is_monetary']) {
unset($value["email-{$this->_bltID}"]);
}
$contactID = CRM_Event_Form_Registration_Confirm::updateContactFields($contactID, $value, $fields, $this);
// lets store the contactID in the session
// we dont store in userID in case the user is doing multiple
// transactions etc
// for things like tell a friend
if (!$this->getContactID() && !empty($value['is_primary'])) {
$session->set('transaction.userID', $contactID);
}
//lets get the status if require approval or waiting.
$waitingStatuses = CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Waiting'");
if ($this->_allowWaitlist && !$this->_allowConfirmation) {
$value['participant_status_id'] = $value['participant_status'] = array_search('On waitlist', $waitingStatuses);
} elseif ($this->_requireApproval && !$this->_allowConfirmation) {
$value['participant_status_id'] = $value['participant_status'] = array_search('Awaiting approval', $waitingStatuses);
}
$this->set('value', $value);
$this->confirmPostProcess($contactID, NULL, NULL);
//lets get additional participant id to cancel.
if ($this->_allowConfirmation && is_array($cancelledIds)) {
$additonalId = CRM_Utils_Array::value('participant_id', $value);
if ($additonalId && ($key = array_search($additonalId, $cancelledIds))) {
unset($cancelledIds[$key]);
}
}
}
}
// update status and send mail to cancelled additional participants, CRM-4320
if ($this->_allowConfirmation && is_array($cancelledIds) && !empty($cancelledIds)) {
$cancelledId = array_search('Cancelled', CRM_Event_PseudoConstant::participantStatus(NULL, "class = 'Negative'"));
CRM_Event_BAO_Participant::transitionParticipants($cancelledIds, $cancelledId);
}
//set information about additional participants if exists
if (count($this->_participantInfo)) {
$this->set('participantInfo', $this->_participantInfo);
}
//send mail Confirmation/Receipt
if ($this->_contributeMode != 'checkout' || $this->_contributeMode != 'notify') {
$isTest = FALSE;
if ($this->_action & CRM_Core_Action::PREVIEW) {
$isTest = TRUE;
}
//handle if no additional participant.
if (!$registerByID) {
$registerByID = $this->get('registerByID');
}
$primaryContactId = $this->get('primaryContactId');
//build an array of custom profile and assigning it to template.
$additionalIDs = CRM_Event_BAO_Event::buildCustomProfile($registerByID, NULL, $primaryContactId, $isTest, TRUE);
//lets carry all participant params w/ values.
foreach ($additionalIDs as $participantID => $contactId) {
$participantNum = NULL;
if ($participantID == $registerByID) {
$participantNum = 0;
} else {
if ($participantNum = array_search('participant', $participantCount)) {
unset($participantCount[$participantNum]);
}
}
if ($participantNum === NULL) {
break;
}
//carry the participant submitted values.
$this->_values['params'][$participantID] = $params[$participantNum];
}
//lets send mails to all with meanigful text, CRM-4320.
$this->assign('isOnWaitlist', $this->_allowWaitlist);
$this->assign('isRequireApproval', $this->_requireApproval);
foreach ($additionalIDs as $participantID => $contactId) {
if ($participantID == $registerByID) {
//set as Primary Participant
$this->assign('isPrimary', 1);
$customProfile = CRM_Event_BAO_Event::buildCustomProfile($participantID, $this->_values, NULL, $isTest);
if (count($customProfile)) {
$this->assign('customProfile', $customProfile);
$this->set('customProfile', $customProfile);
}
} else {
$this->assign('isPrimary', 0);
$this->assign('customProfile', NULL);
}
//send Confirmation mail to Primary & additional Participants if exists
CRM_Event_BAO_Event::sendMail($contactId, $this->_values, $participantID, $isTest);
}
}
}
示例3: _assignMessageVariablesToTemplate
//.........这里部分代码省略.........
$template->assign('pcpBlock', TRUE);
$template->assign('pcp_display_in_roll', $softDAO->pcp_display_in_roll);
$template->assign('pcp_roll_nickname', $softDAO->pcp_roll_nickname);
$template->assign('pcp_personal_note', $softDAO->pcp_personal_note);
//assign the pcp page title for email subject
$pcpDAO = new CRM_PCP_DAO_PCP();
$pcpDAO->id = $softDAO->pcp_id;
if ($pcpDAO->find(TRUE)) {
$template->assign('title', $pcpDAO->title);
}
}
}
if ($this->financial_type_id) {
$values['financial_type_id'] = $this->financial_type_id;
}
$template->assign('trxn_id', $this->trxn_id);
$template->assign('receive_date', CRM_Utils_Date::mysqlToIso($this->receive_date));
$template->assign('contributeMode', 'notify');
$template->assign('action', $this->is_test ? 1024 : 1);
$template->assign('receipt_text', CRM_Utils_Array::value('receipt_text', $values));
$template->assign('is_monetary', 1);
$template->assign('is_recur', (bool) $recur);
$template->assign('currency', $this->currency);
$template->assign('address', CRM_Utils_Address::format($input));
if (!empty($values['customGroup'])) {
$template->assign('customGroup', $values['customGroup']);
}
if ($this->_component == 'event') {
$template->assign('title', $values['event']['title']);
$participantRoles = CRM_Event_PseudoConstant::participantRole();
$viewRoles = array();
foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, $this->_relatedObjects['participant']->role_id) as $k => $v) {
$viewRoles[] = $participantRoles[$v];
}
$values['event']['participant_role'] = implode(', ', $viewRoles);
$template->assign('event', $values['event']);
$template->assign('participant', $values['participant']);
$template->assign('location', $values['location']);
$template->assign('customPre', $values['custom_pre_id']);
$template->assign('customPost', $values['custom_post_id']);
$isTest = FALSE;
if ($this->_relatedObjects['participant']->is_test) {
$isTest = TRUE;
}
$values['params'] = array();
//to get email of primary participant.
$primaryEmail = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Email', $this->_relatedObjects['participant']->contact_id, 'email', 'contact_id');
$primaryAmount[] = array('label' => $this->_relatedObjects['participant']->fee_level . ' - ' . $primaryEmail, 'amount' => $this->_relatedObjects['participant']->fee_amount);
//build an array of cId/pId of participants
$additionalIDs = CRM_Event_BAO_Event::buildCustomProfile($this->_relatedObjects['participant']->id, NULL, $this->_relatedObjects['contact']->id, $isTest, TRUE);
unset($additionalIDs[$this->_relatedObjects['participant']->id]);
//send receipt to additional participant if exists
if (count($additionalIDs)) {
$template->assign('isPrimary', 0);
$template->assign('customProfile', NULL);
//set additionalParticipant true
$values['params']['additionalParticipant'] = TRUE;
foreach ($additionalIDs as $pId => $cId) {
$amount = array();
//to change the status pending to completed
$additional = new CRM_Event_DAO_Participant();
$additional->id = $pId;
$additional->contact_id = $cId;
$additional->find(TRUE);
$additional->register_date = $this->_relatedObjects['participant']->register_date;
$additional->status_id = 1;
$additionalParticipantInfo = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Email', $additional->contact_id, 'email', 'contact_id');
//if additional participant dont have email
//use display name.
if (!$additionalParticipantInfo) {
$additionalParticipantInfo = CRM_Contact_BAO_Contact::displayName($additional->contact_id);
}
$amount[0] = array('label' => $additional->fee_level, 'amount' => $additional->fee_amount);
$primaryAmount[] = array('label' => $additional->fee_level . ' - ' . $additionalParticipantInfo, 'amount' => $additional->fee_amount);
$additional->save();
$additional->free();
$template->assign('amount', $amount);
CRM_Event_BAO_Event::sendMail($cId, $values, $pId, $isTest, $returnMessageText);
}
}
//build an array of custom profile and assigning it to template
$customProfile = CRM_Event_BAO_Event::buildCustomProfile($this->_relatedObjects['participant']->id, $values, NULL, $isTest);
if (count($customProfile)) {
$template->assign('customProfile', $customProfile);
}
// for primary contact
$values['params']['additionalParticipant'] = FALSE;
$template->assign('isPrimary', 1);
$template->assign('amount', $primaryAmount);
$template->assign('register_date', CRM_Utils_Date::isoToMysql($this->_relatedObjects['participant']->register_date));
if ($this->payment_instrument_id) {
$paymentInstrument = CRM_Contribute_PseudoConstant::paymentInstrument();
$template->assign('paidBy', $paymentInstrument[$this->payment_instrument_id]);
}
// carry paylater, since we did not created billing,
// so need to pull email from primary location, CRM-4395
$values['params']['is_pay_later'] = $this->_relatedObjects['participant']->is_pay_later;
}
return $template;
}
示例4: postProcess
//.........这里部分代码省略.........
$primaryParticipant['participants_info'][$participantID] = $params[$participantNum];
}
//get event custom field information
$groupTree = CRM_Core_BAO_CustomGroup::getTree('Event', $this, $this->_eventId, 0, $this->_values['event']['event_type_id']);
$primaryParticipant['eventCustomFields'] = $groupTree;
// call postprocess hook before leaving
$this->postProcessHook();
// this does not return
$payment->doPayment($primaryParticipant, 'event');
} else {
CRM_Core_Error::fatal($paymentObjError);
}
}
} else {
//otherwise send mail Confirmation/Receipt
$primaryContactId = $this->get('primaryContactId');
//build an array of cId/pId of participants
$additionalIDs = CRM_Event_BAO_Event::buildCustomProfile($registerByID, NULL, $primaryContactId, $isTest, TRUE);
//lets send mails to all with meaningful text, CRM-4320.
$this->assign('isOnWaitlist', $this->_allowWaitlist);
$this->assign('isRequireApproval', $this->_requireApproval);
//need to copy, since we are unsetting on the way.
$copyParticipantCount = $participantCount;
//lets carry all paticipant params w/ values.
foreach ($additionalIDs as $participantID => $contactId) {
$participantNum = NULL;
if ($participantID == $registerByID) {
$participantNum = 0;
} else {
if ($participantNum = array_search('participant', $copyParticipantCount)) {
unset($copyParticipantCount[$participantNum]);
}
}
if ($participantNum === NULL) {
break;
}
//carry the participant submitted values.
$this->_values['params'][$participantID] = $params[$participantNum];
}
foreach ($additionalIDs as $participantID => $contactId) {
$participantNum = 0;
if ($participantID == $registerByID) {
//set as Primary Participant
$this->assign('isPrimary', 1);
//build an array of custom profile and assigning it to template.
$customProfile = CRM_Event_BAO_Event::buildCustomProfile($participantID, $this->_values, NULL, $isTest);
if (count($customProfile)) {
$this->assign('customProfile', $customProfile);
$this->set('customProfile', $customProfile);
}
$this->_values['params']['additionalParticipant'] = FALSE;
} else {
//take the Additional participant number.
if ($participantNum = array_search('participant', $participantCount)) {
unset($participantCount[$participantNum]);
}
// Change $this->_values['participant'] to include additional participant values
$ids = $participantValues = array();
$participantParams = array('id' => $participantID);
CRM_Event_BAO_Participant::getValues($participantParams, $participantValues, $ids);
$this->_values['participant'] = $participantValues[$participantID];
$this->assign('isPrimary', 0);
$this->assign('customProfile', NULL);
//Additional Participant should get only it's payment information
if (!empty($this->_amount)) {
$amount = array();
$params = $this->get('params');
$amount[$participantNum]['label'] = preg_replace('//', '', $params[$participantNum]['amount_level']);
$amount[$participantNum]['amount'] = $params[$participantNum]['amount'];
$this->assign('amounts', $amount);
}
if ($this->_lineItem) {
$lineItems = $this->_lineItem;
$lineItem = array();
if ($lineItemValue = CRM_Utils_Array::value($participantNum, $lineItems)) {
$lineItem[] = $lineItemValue;
}
if ($invoicing) {
$individual = $this->get('individual');
$dataArray[key($dataArray)] = $individual[$participantNum]['totalTaxAmt'];
$this->assign('dataArray', $dataArray);
$this->assign('totalAmount', $individual[$participantNum]['totalAmtWithTax']);
$this->assign('totalTaxAmount', $individual[$participantNum]['totalTaxAmt']);
$this->assign('individual', array($individual[$participantNum]));
}
$this->assign('lineItem', $lineItem);
}
$this->_values['params']['additionalParticipant'] = TRUE;
$this->assign('isAdditionalParticipant', $this->_values['params']['additionalParticipant']);
}
//pass these variables since these are run time calculated.
$this->_values['params']['isOnWaitlist'] = $this->_allowWaitlist;
$this->_values['params']['isRequireApproval'] = $this->_requireApproval;
//send mail to primary as well as additional participants.
$this->assign('contactID', $contactId);
$this->assign('participantID', $participantID);
CRM_Event_BAO_Event::sendMail($contactId, $this->_values, $participantID, $isTest);
}
}
}
示例5: sendMail
function sendMail(&$input, &$ids, &$objects, &$values, $recur = false, $returnMessageText = false)
{
$contribution =& $objects['contribution'];
$membership =& $objects['membership'];
$participant =& $objects['participant'];
$event =& $objects['event'];
if (empty($values)) {
$values = array();
if ($input['component'] == 'contribute') {
require_once 'CRM/Contribute/BAO/ContributionPage.php';
if (isset($contribution->contribution_page_id)) {
CRM_Contribute_BAO_ContributionPage::setValues($contribution->contribution_page_id, $values);
} else {
// Handle re-print receipt for offline contributions (call from PDF.php - no contribution_page_id)
$values['is_email_receipt'] = 1;
$values['title'] = 'Contribution';
}
} else {
// event
$eventParams = array('id' => $objects['event']->id);
$values['event'] = array();
require_once 'CRM/Event/BAO/Event.php';
CRM_Event_BAO_Event::retrieve($eventParams, $values['event']);
$eventParams = array('id' => $objects['event']->id);
$values['event'] = array();
require_once 'CRM/Event/BAO/Event.php';
CRM_Event_BAO_Event::retrieve($eventParams, $values['event']);
//get location details
$locationParams = array('entity_id' => $objects['event']->id, 'entity_table' => 'civicrm_event');
require_once 'CRM/Core/BAO/Location.php';
require_once 'CRM/Event/Form/ManageEvent/Location.php';
$values['location'] = CRM_Core_BAO_Location::getValues($locationParams);
require_once 'CRM/Core/BAO/UFJoin.php';
$ufJoinParams = array('entity_table' => 'civicrm_event', 'entity_id' => $ids['event'], 'weight' => 1);
$values['custom_pre_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
$ufJoinParams['weight'] = 2;
$values['custom_post_id'] = CRM_Core_BAO_UFJoin::findUFGroupId($ufJoinParams);
}
}
$template =& CRM_Core_Smarty::singleton();
// CRM_Core_Error::debug('tpl',$template);
//assign honor infomation to receiptmessage
if ($honarID = CRM_Core_DAO::getFieldValue('CRM_Contribute_DAO_Contribution', $contribution->id, 'honor_contact_id')) {
$honorDefault = array();
$honorIds = array();
$honorIds['contribution'] = $contribution->id;
$idParams = array('id' => $honarID, 'contact_id' => $honarID);
require_once "CRM/Contact/BAO/Contact.php";
CRM_Contact_BAO_Contact::retrieve($idParams, $honorDefault, $honorIds);
require_once "CRM/Core/PseudoConstant.php";
$honorType = CRM_Core_PseudoConstant::honor();
$prefix = CRM_Core_PseudoConstant::individualPrefix();
$template->assign('honor_block_is_active', 1);
$template->assign('honor_prefix', $prefix[$honorDefault["prefix_id"]]);
$template->assign('honor_first_name', CRM_Utils_Array::value("first_name", $honorDefault));
$template->assign('honor_last_name', CRM_Utils_Array::value("last_name", $honorDefault));
$template->assign('honor_email', CRM_Utils_Array::value("email", $honorDefault["email"][1]));
$template->assign('honor_type', $honorType[$contribution->honor_type_id]);
}
require_once 'CRM/Contribute/DAO/ContributionProduct.php';
$dao =& new CRM_Contribute_DAO_ContributionProduct();
$dao->contribution_id = $contribution->id;
if ($dao->find(true)) {
$premiumId = $dao->product_id;
$template->assign('option', $dao->product_option);
require_once 'CRM/Contribute/DAO/Product.php';
$productDAO =& new CRM_Contribute_DAO_Product();
$productDAO->id = $premiumId;
$productDAO->find(true);
$template->assign('selectPremium', true);
$template->assign('product_name', $productDAO->name);
$template->assign('price', $productDAO->price);
$template->assign('sku', $productDAO->sku);
}
// add the new contribution values
if ($input['component'] == 'contribute') {
$template->assign('title', $values['title']);
$template->assign('amount', $input['amount']);
//PCP Info
require_once 'CRM/Contribute/DAO/ContributionSoft.php';
$softDAO =& new CRM_Contribute_DAO_ContributionSoft();
$softDAO->contribution_id = $contribution->id;
if ($softDAO->find(true)) {
$template->assign('pcpBlock', true);
$template->assign('pcp_display_in_roll', $softDAO->pcp_display_in_roll);
$template->assign('pcp_roll_nickname', $softDAO->pcp_roll_nickname);
$template->assign('pcp_personal_note', $softDAO->pcp_personal_note);
//assign the pcp page title for email subject
require_once 'CRM/Contribute/DAO/PCP.php';
$pcpDAO =& new CRM_Contribute_DAO_PCP();
$pcpDAO->id = $softDAO->pcp_id;
if ($pcpDAO->find(true)) {
$template->assign('title', $pcpDAO->title);
}
}
} else {
$template->assign('title', $values['event']['title']);
$template->assign('totalAmount', $input['amount']);
}
$template->assign('trxn_id', $contribution->trxn_id);
//.........这里部分代码省略.........
示例6: postProcess
//.........这里部分代码省略.........
if ($this->_allowConfirmation && !empty($this->_additionalParticipantIds)) {
$allParticipantIds = array_merge(array($registerByID), $this->_additionalParticipantIds);
}
$entityTable = 'civicrm_participant';
foreach ($this->_lineItem as $key => $value) {
if ($value != 'skip' && ($entityId = CRM_Utils_Array::value($key, $allParticipantIds))) {
// do cleanup line items if participant re-walking wizard.
if ($this->_allowConfirmation) {
CRM_Price_BAO_LineItem::deleteLineItems($entityId, $entityTable);
}
// create line.
foreach ($value as $line) {
$line['entity_id'] = $entityId;
$line['entity_table'] = $entityTable;
CRM_Price_BAO_LineItem::create($line);
}
}
}
}
//update status and send mail to cancelled additonal participants, CRM-4320
if ($this->_allowConfirmation && is_array($cancelledIds) && !empty($cancelledIds)) {
require_once 'CRM/Event/BAO/Participant.php';
require_once 'CRM/Event/PseudoConstant.php';
$cancelledId = array_search('Cancelled', CRM_Event_PseudoConstant::participantStatus(null, "class = 'Negative'"));
CRM_Event_BAO_Participant::transitionParticipants($cancelledIds, $cancelledId);
}
$isTest = false;
if ($this->_action & CRM_Core_Action::PREVIEW) {
$isTest = true;
}
// for Transfer checkout.
require_once "CRM/Event/BAO/Event.php";
if (($this->_contributeMode == 'checkout' || $this->_contributeMode == 'notify') && !CRM_Utils_Array::value('is_pay_later', $params[0]) && !$this->_allowWaitlist && !$this->_requireApproval && $this->_totalAmount > 0) {
$primaryParticipant = $this->get('primaryParticipant');
if (!CRM_Utils_Array::value('participantID', $primaryParticipant)) {
$primaryParticipant['participantID'] = $registerByID;
}
//build an array of custom profile and assigning it to template
$customProfile = CRM_Event_BAO_Event::buildCustomProfile($registerByID, $this->_values, null, $isTest);
if (count($customProfile)) {
$this->assign('customProfile', $customProfile);
$this->set('customProfile', $customProfile);
}
// do a transfer only if a monetary payment greater than 0
if ($this->_values['event']['is_monetary'] && $primaryParticipant && $payment) {
$payment->doTransferCheckout($primaryParticipant);
}
} else {
//otherwise send mail Confirmation/Receipt
$primaryContactId = $this->get('primaryContactId');
//build an array of cId/pId of participants
require_once "CRM/Event/BAO/Event.php";
$additionalIDs = CRM_Event_BAO_Event::buildCustomProfile($registerByID, null, $primaryContactId, $isTest, true);
//lets send mails to all with meaningful text, CRM-4320.
$this->assign('isOnWaitlist', $this->_allowWaitlist);
$this->assign('isRequireApproval', $this->_requireApproval);
foreach ($additionalIDs as $participantID => $contactId) {
if ($participantID == $registerByID) {
//set as Primary Participant
$this->assign('isPrimary', 1);
//build an array of custom profile and assigning it to template.
$customProfile = CRM_Event_BAO_Event::buildCustomProfile($participantID, $this->_values, null, $isTest);
if (count($customProfile)) {
$this->assign('customProfile', $customProfile);
$this->set('customProfile', $customProfile);
}
$this->_values['params']['additionalParticipant'] = false;
} else {
//take the Additional participant number.
if ($paticipantNum = array_search('participant', $participantCount)) {
unset($participantCount[$paticipantNum]);
}
$this->assign('isPrimary', 0);
$this->assign('customProfile', null);
//Additional Participant should get only it's payment information
if ($this->_amount) {
$amount = array();
$params = $this->get('params');
$amount[$paticipantNum]['label'] = $params[$paticipantNum]['amount_level'];
$amount[$paticipantNum]['amount'] = $params[$paticipantNum]['amount'];
$this->assign('amount', $amount);
}
if ($this->_lineItem) {
$lineItems = $this->_lineItem;
$lineItem = array();
$lineItem[] = CRM_Utils_Array::value($paticipantNum, $lineItems);
$this->assign('lineItem', $lineItem);
}
$this->_values['params']['additionalParticipant'] = true;
}
//pass these variables since these are run time calculated.
$this->_values['params']['isOnWaitlist'] = $this->_allowWaitlist;
$this->_values['params']['isRequireApproval'] = $this->_requireApproval;
//send mail to primary as well as additional participants.
$this->assign('contactID', $contactId);
$this->assign('participantID', $participantID);
CRM_Event_BAO_Event::sendMail($contactId, $this->_values, $participantID, $isTest);
}
}
}
示例7: processRegistration
//.........这里部分代码省略.........
// those are drop or skip by primary at the time of confirmation.
// get all in and then unset those are confirmed.
$cancelledIds = $this->_additionalParticipantIds;
foreach ($params as $key => $value) {
if ($value != 'skip') {
$fields = null;
// setting register by Id and unset contactId.
if (!CRM_Utils_Array::value('is_primary', $value)) {
$contactID = null;
$registerByID = $this->get('registerByID');
if ($registerByID) {
$value['registered_by_id'] = $registerByID;
}
if (CRM_Utils_Array::value("email-{$this->_bltID}", $value)) {
$this->_participantInfo[] = $value["email-{$this->_bltID}"];
} else {
$this->_participantInfo[] = $value['first_name'] . ' ' . $value['last_name'];
}
}
require_once 'CRM/Event/Form/Registration/Confirm.php';
CRM_Event_Form_Registration_Confirm::fixLocationFields($value, $fields);
//for free event or additional participant, dont create billing email address.
if (!CRM_Utils_Array::value('is_primary', $value) || !$this->_values['event']['is_monetary']) {
unset($value["email-{$this->_bltID}"]);
}
$contactID =& CRM_Event_Form_Registration_Confirm::updateContactFields($contactID, $value, $fields);
// lets store the contactID in the session
// we dont store in userID in case the user is doing multiple
// transactions etc
// for things like tell a friend
if (!$session->get('userID') && CRM_Utils_Array::value('is_primary', $value)) {
$session->set('transaction.userID', $contactID);
}
//lets get the status if require approval or waiting.
require_once 'CRM/Event/PseudoConstant.php';
$waitingStatuses = CRM_Event_PseudoConstant::participantStatus(null, "class = 'Waiting'");
if ($this->_allowWaitlist && !$this->_allowConfirmation) {
$value['participant_status_id'] = array_search('On waitlist', $waitingStatuses);
} else {
if ($this->_requireApproval && !$this->_allowConfirmation) {
$value['participant_status_id'] = array_search('Awaiting approval', $waitingStatuses);
}
}
$this->set('value', $value);
$this->confirmPostProcess($contactID, null, null);
//lets get additional participant id to cancel.
if ($this->_allowConfirmation && is_array($cancelledIds)) {
$additonalId = CRM_Utils_Array::value('participant_id', $value);
if ($additonalId && ($key = array_search($additonalId, $cancelledIds))) {
unset($cancelledIds[$key]);
}
}
}
}
// update status and send mail to cancelled additonal participants, CRM-4320
if ($this->_allowConfirmation && is_array($cancelledIds) && !empty($cancelledIds)) {
require_once 'CRM/Event/BAO/Participant.php';
require_once 'CRM/Event/PseudoConstant.php';
$cancelledId = array_search('Cancelled', CRM_Event_PseudoConstant::participantStatus(null, "class = 'Negative'"));
CRM_Event_BAO_Participant::transitionParticipants($cancelledIds, $cancelledId);
}
//set information about additional participants if exists
if (count($this->_participantInfo)) {
$this->set('participantInfo', $this->_participantInfo);
}
//send mail Confirmation/Receipt
require_once "CRM/Event/BAO/Event.php";
if ($this->_contributeMode != 'checkout' || $this->_contributeMode != 'notify') {
$isTest = false;
if ($this->_action & CRM_Core_Action::PREVIEW) {
$isTest = true;
}
//handle if no additional participant.
if (!$registerByID) {
$registerByID = $this->get('registerByID');
}
$primaryContactId = $this->get('primaryContactId');
//build an array of custom profile and assigning it to template.
$additionalIDs = CRM_Event_BAO_Event::buildCustomProfile($registerByID, null, $primaryContactId, $isTest, true);
//lets send mails to all with meanigful text, CRM-4320.
$this->assign('isOnWaitlist', $this->_allowWaitlist);
$this->assign('isRequireApproval', $this->_requireApproval);
foreach ($additionalIDs as $participantID => $contactId) {
if ($participantID == $registerByID) {
//set as Primary Participant
$this->assign('isPrimary', 1);
$customProfile = CRM_Event_BAO_Event::buildCustomProfile($participantID, $this->_values, null, $isTest);
if (count($customProfile)) {
$this->assign('customProfile', $customProfile);
$this->set('customProfile', $customProfile);
}
} else {
$this->assign('isPrimary', 0);
$this->assign('customProfile', null);
}
//send Confirmation mail to Primary & additional Participants if exists
CRM_Event_BAO_Event::sendMail($contactId, $this->_values, $participantID, $isTest);
}
}
}