<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.7 |
+ | CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2017 |
+ | Copyright CiviCRM LLC (c) 2004-2018 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2017
+ * @copyright CiviCRM LLC (c) 2004-2018
* $Id$
*
*/
* @var array
*/
protected $_details = array();
+ /**
+ * Is backoffice form?
+ *
+ * @array bool
+ */
+ protected $isBackoffice = FALSE;
/**
* Set variables up before form is built based on participant ID from URL
*
$participant = $values = array();
$this->_participant_id = CRM_Utils_Request::retrieve('pid', 'Positive', $this, FALSE, NULL, 'REQUEST');
$this->_userChecksum = CRM_Utils_Request::retrieve('cs', 'String', $this, FALSE, NULL, 'REQUEST');
+ $this->isBackoffice = CRM_Utils_Request::retrieve('is_backoffice', 'String', $this, FALSE, NULL, 'REQUEST');
$params = array('id' => $this->_participant_id);
$this->_participant = CRM_Event_BAO_Participant::getValues($params, $values, $participant);
$this->_part_values = $values[$this->_participant_id];
while ($dao->fetch()) {
$details['status'] = $dao->status;
$details['role'] = $dao->role;
- $details['fee_level'] = $dao->fee_level;
+ $details['fee_level'] = trim($dao->fee_level, CRM_Core_DAO::VALUE_SEPARATOR);
$details['fee_amount'] = $dao->fee_amount;
$details['register_date'] = $dao->register_date;
$details['event_start_date'] = $dao->start_date;
}
$start_time = new Datetime($start_date);
$timenow = new Datetime();
- if (!empty($start_time) && $start_time < $timenow) {
+ 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.");
CRM_Core_Error::statusBounce($status, $url, ts('Sorry'));
}
- if (!empty($time_limit) && $time_limit > 0) {
+ if (!$this->isBackoffice && !empty($time_limit) && $time_limit > 0) {
$interval = $timenow->diff($start_time);
$days = $interval->format('%d');
$hours = $interval->format('%h');
* return @void
*/
public function transferParticipant($params) {
- $transferUrl = 'civicrm/event/form/selfsvctransfer';
- $url = CRM_Utils_System::url('civicrm/event/selfsvctransfer', 'reset=1&action=add&pid=' . $this->_participant_id . '&cs=' . $this->_userChecksum);
- $this->controller->setDestination($url);
- $session = CRM_Core_Session::singleton();
- $session->replaceUserContext($url);
+ $isBackOfficeArg = $this->isBackoffice ? '&is_backoffice=1' : '';
+ CRM_Utils_System::redirect(CRM_Utils_System::url(
+ 'civicrm/event/selfsvctransfer',
+ array(
+ 'reset' => 1,
+ 'action' => 'add',
+ 'pid' => $this->_participant_id,
+ 'cs' => $this->_userChecksum,
+ )
+ ));
}
/**
$statusMsg = ts('Event registration information for %1 has been updated.', array(1 => $this->_contact_name));
$statusMsg .= ' ' . ts('A cancellation email has been sent to %1.', array(1 => $this->_contact_email));
CRM_Core_Session::setStatus($statusMsg, ts('Thanks'), 'success');
+ if (!empty($this->isBackoffice)) {
+ return;
+ }
$url = CRM_Utils_System::url('civicrm/event/info', "reset=1&id={$this->_event_id}&noFullMsg=true");
CRM_Utils_System::redirect($url);
}