本文整理汇总了PHP中CRM_Event_Form_Registration::addParticipant方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Event_Form_Registration::addParticipant方法的具体用法?PHP CRM_Event_Form_Registration::addParticipant怎么用?PHP CRM_Event_Form_Registration::addParticipant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Event_Form_Registration
的用法示例。
在下文中一共展示了CRM_Event_Form_Registration::addParticipant方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
//.........这里部分代码省略.........
CRM_Core_Payment_Form::mapParams($this->_bltID, $mapParams, $paymentParams, TRUE);
$payment = $this->_paymentProcessor['object'];
// CRM-15622: fix for incorrect contribution.fee_amount
$paymentParams['fee_amount'] = NULL;
$result = $payment->doPayment($paymentParams);
if (is_a($result, 'CRM_Core_Error')) {
CRM_Core_Error::displaySessionError($result);
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view/participant', "reset=1&action=add&cid={$this->_contactId}&context=participant&mode={$this->_mode}"));
}
if ($result) {
$this->_params = array_merge($this->_params, $result);
}
$this->_params['receive_date'] = $now;
if (!empty($this->_params['send_receipt'])) {
$this->_params['receipt_date'] = $now;
} else {
$this->_params['receipt_date'] = NULL;
}
$this->set('params', $this->_params);
$this->assign('trxn_id', $result['trxn_id']);
$this->assign('receive_date', CRM_Utils_Date::processDate($this->_params['receive_date']));
//add contribution record
$this->_params['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'financial_type_id');
$this->_params['mode'] = $this->_mode;
//add contribution record
$contributions[] = $contribution = CRM_Event_Form_Registration_Confirm::processContribution($this, $this->_params, $result, $contactID, FALSE);
// add participant record
$participants = array();
if (!empty($this->_params['role_id']) && is_array($this->_params['role_id'])) {
$this->_params['role_id'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $this->_params['role_id']);
}
//CRM-15372 patch to fix fee amount replacing amount
$this->_params['fee_amount'] = $this->_params['amount'];
$participants[] = CRM_Event_Form_Registration::addParticipant($this, $contactID);
//add custom data for participant
CRM_Core_BAO_CustomValueTable::postProcess($this->_params, 'civicrm_participant', $participants[0]->id, 'Participant');
//add participant payment
$paymentParticipant = array('participant_id' => $participants[0]->id, 'contribution_id' => $contribution->id);
$ids = array();
CRM_Event_BAO_ParticipantPayment::create($paymentParticipant, $ids);
$this->_contactIds[] = $this->_contactId;
} else {
$participants = array();
if ($this->_single) {
if ($params['role_id']) {
$params['role_id'] = $roleIdWithSeparator;
} else {
$params['role_id'] = 'NULL';
}
$participants[] = CRM_Event_BAO_Participant::create($params);
} else {
foreach ($this->_contactIds as $contactID) {
$commonParams = $params;
$commonParams['contact_id'] = $contactID;
if ($commonParams['role_id']) {
$commonParams['role_id'] = $commonParams['role_id'] = str_replace(',', CRM_Core_DAO::VALUE_SEPARATOR, $params['role_id']);
} else {
$commonParams['role_id'] = 'NULL';
}
$participants[] = CRM_Event_BAO_Participant::create($commonParams);
}
}
if (isset($params['event_id'])) {
$eventTitle = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'title');
}
if ($this->_single) {
示例2: confirmPostProcess
/**
* Handle process after the confirmation of payment by User.
*
* @param int $contactID
* @param null $contribution
* @param null $payment
*/
public function confirmPostProcess($contactID = NULL, $contribution = NULL, $payment = NULL)
{
// add/update contact information
$fields = array();
unset($this->_params['note']);
//to avoid conflict overwrite $this->_params
$this->_params = $this->get('value');
//get the amount of primary participant
if (!empty($this->_params['is_primary'])) {
$this->_params['fee_amount'] = $this->get('primaryParticipantAmount');
}
// add participant record
$participant = CRM_Event_Form_Registration::addParticipant($this, $contactID);
$this->_participantIDS[] = $participant->id;
//setting register_by_id field and primaryContactId
if (!empty($this->_params['is_primary'])) {
$this->set('registerByID', $participant->id);
$this->set('primaryContactId', $contactID);
// CRM-10032
$this->processFirstParticipant($participant->id);
}
CRM_Core_BAO_CustomValueTable::postProcess($this->_params, 'civicrm_participant', $participant->id, 'Participant');
$createPayment = CRM_Utils_Array::value('amount', $this->_params, 0) != 0 ? TRUE : FALSE;
// force to create zero amount payment, CRM-5095
// we know the amout is zero since createPayment is false
if (!$createPayment && (isset($contribution) && $contribution->id) && $this->_priceSetId && $this->_lineItem) {
$createPayment = TRUE;
}
if ($createPayment && $this->_values['event']['is_monetary'] && !empty($this->_params['contributionID'])) {
$paymentParams = array('participant_id' => $participant->id, 'contribution_id' => $contribution->id);
$ids = array();
$paymentPartcipant = CRM_Event_BAO_ParticipantPayment::create($paymentParams, $ids);
}
//set only primary participant's params for transfer checkout.
// The concept of contributeMode is deprecated.
if (($this->_contributeMode == 'checkout' || $this->_contributeMode == 'notify') && !empty($this->_params['is_primary'])) {
$this->_params['participantID'] = $participant->id;
$this->set('primaryParticipant', $this->_params);
}
$this->assign('action', $this->_action);
// create CMS user
if (!empty($this->_params['cms_create_account'])) {
$this->_params['contactID'] = $contactID;
if (array_key_exists('email-5', $this->_params)) {
$mail = 'email-5';
} else {
foreach ($this->_params as $name => $dontCare) {
if (substr($name, 0, 5) == 'email') {
$mail = $name;
break;
}
}
}
// we should use primary email for
// 1. free event registration.
// 2. pay later participant.
// 3. waiting list participant.
// 4. require approval participant.
if (!empty($this->_params['is_pay_later']) || $this->_allowWaitlist || $this->_requireApproval || empty($this->_values['event']['is_monetary'])) {
$mail = 'email-Primary';
}
if (!CRM_Core_BAO_CMSUser::create($this->_params, $mail)) {
CRM_Core_Error::statusBounce(ts('Your profile is not saved and Account is not created.'));
}
}
}
示例3: postProcess
//.........这里部分代码省略.........
$paymentParams['email'] = $this->_contributorEmail;
}
require_once 'CRM/Core/Payment/Form.php';
CRM_Core_Payment_Form::mapParams($this->_bltID, $this->_params, $paymentParams, true);
$payment =& CRM_Core_Payment::singleton($this->_mode, 'Event', $this->_paymentProcessor, $this);
$result =& $payment->doDirectPayment($paymentParams);
if (is_a($result, 'CRM_Core_Error')) {
CRM_Core_Error::displaySessionError($result);
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view/participant', "reset=1&action=add&cid={$this->_contactID}&context=participant&mode={$this->_mode}"));
}
if ($result) {
$this->_params = array_merge($this->_params, $result);
}
$this->_params['receive_date'] = $now;
if (CRM_Utils_Array::value('send_receipt', $this->_params)) {
$this->_params['receipt_date'] = $now;
} else {
$this->_params['receipt_date'] = null;
}
$this->set('params', $this->_params);
$this->assign('trxn_id', $result['trxn_id']);
$this->assign('receive_date', CRM_Utils_Date::processDate($this->_params['receive_date']));
// set source if not set
$this->_params['description'] = ts('Submit Credit Card for Event Registration by: %1', array(1 => $userName));
require_once 'CRM/Event/Form/Registration/Confirm.php';
require_once 'CRM/Event/Form/Registration.php';
//add contribution record
$this->_params['contribution_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'contribution_type_id');
$this->_params['mode'] = $this->_mode;
//add contribution reocord
$contribution = CRM_Event_Form_Registration_Confirm::processContribution($this, $this->_params, $result, $contactID, false);
// add participant record
$participants = array();
$participants[] = CRM_Event_Form_Registration::addParticipant($this->_params, $contactID);
//add custom data for participant
require_once 'CRM/Core/BAO/CustomValueTable.php';
CRM_Core_BAO_CustomValueTable::postProcess($this->_params, CRM_Core_DAO::$_nullArray, 'civicrm_participant', $participants[0]->id, 'Participant');
//add participant payment
require_once 'CRM/Event/BAO/ParticipantPayment.php';
$paymentParticipant = array('participant_id' => $participants[0]->id, 'contribution_id' => $contribution->id);
$ids = array();
CRM_Event_BAO_ParticipantPayment::create($paymentParticipant, $ids);
$eventTitle = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'title');
$this->_contactIds[] = $this->_contactID;
} else {
$participants = array();
// fix note if deleted
if (!$params['note']) {
$params['note'] = 'null';
}
if ($this->_single) {
$participants[] = CRM_Event_BAO_Participant::create($params);
} else {
foreach ($this->_contactIds as $contactID) {
$commonParams = $params;
$commonParams['contact_id'] = $contactID;
$participants[] = CRM_Event_BAO_Participant::create($commonParams);
}
}
if (isset($params['event_id'])) {
$eventTitle = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $params['event_id'], 'title');
}
if ($this->_single) {
$this->_contactIds[] = $this->_contactID;
}
if (CRM_Utils_Array::value('record_contribution', $params)) {