*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
- * $Id$
- *
*/
/**
* be transferred to this participant - at this point no transaction changes processed
*
* return @void
+ *
+ * @throws \CRM_Core_Exception
*/
public function preProcess() {
- $config = CRM_Core_Config::singleton();
$session = CRM_Core_Session::singleton();
$this->_userContext = $session->readUserContext();
$this->_from_participant_id = CRM_Utils_Request::retrieve('pid', 'Positive', $this, FALSE, NULL, 'REQUEST');
if ($this->_from_participant_id) {
$this->assign('participantId', $this->_from_participant_id);
}
- $event = [];
+
$daoName = 'title';
$this->_event_title = CRM_Event_BAO_Event::getFieldValue('CRM_Event_DAO_Event', $this->_event_id, $daoName);
$daoName = 'start_date';
list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_from_contact_id);
$this->_contact_name = $displayName;
$this->_contact_email = $email;
- $details = [];
+
$details = CRM_Event_BAO_Participant::participantDetails($this->_from_participant_id);
$optionGroupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'participant_role', 'id', 'name');
$query = "
// verify whether this contact already registered for this event
$contact_details = CRM_Contact_BAO_Contact::getContactDetails($contact_id);
$display_name = $contact_details[0];
- $query = "select event_id from civicrm_participant where contact_id = " . $contact_id;
+ $query = 'select event_id from civicrm_participant where contact_id = ' . $contact_id;
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$to_event_id[] = $dao->event_id;
/**
* Process transfer - first add the new participant to the event, then cancel
* source participant - send confirmation email to transferee
+ *
+ * @throws \CiviCRM_API3_Exception
*/
public function postProcess() {
//For transfer, process form to allow selection of transferree
//cancel 'from' participant row
$contact_id_result = civicrm_api3('Contact', 'get', [
'sequential' => 1,
- 'return' => ["id"],
+ 'return' => ['id'],
'email' => $params['email'],
'options' => ['limit' => 1],
]);
CRM_Core_Error::statusBounce(ts('Contact does not exist.'));
}
}
- $from_participant = $params = [];
- $query = "select role_id, source, fee_level, is_test, is_pay_later, fee_amount, discount_id, fee_currency,campaign_id, discount_amount from civicrm_participant where id = " . $this->_from_participant_id;
+
+ $query = 'select role_id, source, fee_level, is_test, is_pay_later, fee_amount, discount_id, fee_currency,campaign_id, discount_amount from civicrm_participant where id = ' . $this->_from_participant_id;
$dao = CRM_Core_DAO::executeQuery($query);
$value_to = [];
while ($dao->fetch()) {
* Based on input, create participant row for transferee and send email
*
* return @ void
+ *
+ * @throws \CRM_Core_Exception
*/
public function participantTransfer($participant) {
$contactDetails = [];
foreach ($tokens['domain'] as $token) {
$domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain);
}
- $participantRoles = [];
+
$participantRoles = CRM_Event_PseudoConstant::participantRole();
$participantDetails = [];
$query = "SELECT * FROM civicrm_participant WHERE id = {$this->_from_participant_id}";
*
* @package CRM
* @copyright CiviCRM LLC https://civicrm.org/licensing
- * $Id$
- *
*/
/**
* Set variables up before form is built based on participant ID from URL
*
* @return void
+ *
+ * @throws \CRM_Core_Exception
*/
public function preProcess() {
$config = CRM_Core_Config::singleton();
if ($this->_participant_id) {
$this->assign('participantId', $this->_participant_id);
}
- $event = [];
+
$daoName = 'title';
$this->_event_title = CRM_Event_BAO_Event::getFieldValue('CRM_Event_DAO_Event', $this->_event_id, $daoName);
$daoName = 'start_date';
list($displayName, $email) = CRM_Contact_BAO_Contact_Location::getEmailDetails($this->_contact_id);
$this->_contact_name = $displayName;
$this->_contact_email = $email;
- $details = [];
+
$details = CRM_Event_BAO_Participant::participantDetails($this->_participant_id);
$optionGroupId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'participant_role', 'id', 'name');
$contributionId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', $this->_participant_id, 'contribution_id', 'participant_id');
$details['event_start_date'] = $dao->start_date;
}
//verify participant status is still Registered
- if ($details['status'] != "Registered") {
+ if ($details['status'] !== 'Registered') {
$status = "You cannot transfer or cancel your registration for " . $this->_event_title . ' as you are not currently registered for this event.';
CRM_Core_Session::setStatus($status, ts('Sorry'), 'alert');
CRM_Utils_System::redirect($url);
$start_time = new Datetime($start_date);
$timenow = new Datetime();
if (!$this->isBackoffice && !empty($start_time) && $start_time < $timenow) {
- $status = ts("Registration for this event cannot be cancelled or transferred once the event has begun. Contact the event organizer if you have questions.");
+ $status = ts('Registration for this event cannot be cancelled or transferred once the event has begun. Contact the event organizer if you have questions.');
CRM_Core_Error::statusBounce($status, $url, ts('Sorry'));
}
if (!$this->isBackoffice && !empty($time_limit) && $time_limit > 0) {
$params = $this->controller->exportValues($this->_name);
$action = $params['action'];
if ($action == "1") {
- $action = "Transfer Event";
$this->transferParticipant($params);
}
elseif ($action == "2") {
- $action = "Cancel Event";
$this->cancelParticipant($params);
}
}
* auto-cancellation of payment is handled, so payment needs to be manually cancelled
*
* return @void
+ *
+ * @throws \CRM_Core_Exception
*/
public function cancelParticipant($params) {
//set participant record status to Cancelled, refund payment if possible
foreach ($tokens['domain'] as $token) {
$domainValues[$token] = CRM_Utils_Token::getDomainTokenReplacement($token, $domain);
}
- $participantRoles = [];
+
$participantRoles = CRM_Event_PseudoConstant::participantRole();
$participantDetails = [];
$query = "SELECT * FROM civicrm_participant WHERE id = {$this->_participant_id}";