diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index 71c3204b8ce7..d39e44a055a5 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -367,6 +367,9 @@ public function preProcess() { // when fee amount is included in form if (!empty($_POST['hidden_feeblock']) || !empty($_POST['send_receipt'])) { + if ($this->_submitValues['event_id']) { + $this->_eventId = $this->_submitValues['event_id']; + } CRM_Event_Form_EventFees::preProcess($this); $this->buildEventFeeForm($this); CRM_Event_Form_EventFees::setDefaultValues($this); diff --git a/CRM/Event/Form/Task/Register.php b/CRM/Event/Form/Task/Register.php index b13a5619db24..6bdcb8ae204f 100644 --- a/CRM/Event/Form/Task/Register.php +++ b/CRM/Event/Form/Task/Register.php @@ -71,8 +71,12 @@ protected function assignUrlPath() { $this->_contactId = NULL; //set ajax path, this used for custom data building - $this->assign('urlPath', $urlString); - $this->assign('urlPathVar', "_qf_Participant_display=true&qfKey={$this->controller->_key}"); + $this->assign('urlPath', 'civicrm/contact/view/participant'); + + $key = CRM_Core_Key::get('CRM_Event_Form_Participant', TRUE); + $this->assign('participantQfKey', $key); + $this->assign('participantAction', CRM_Core_Action::ADD); + $this->assign('urlPathVar', "_qf_Participant_display=true&context=search"); } } diff --git a/CRM/Event/Page/Tab.php b/CRM/Event/Page/Tab.php index 0ecd0f80631e..47334d4af59c 100644 --- a/CRM/Event/Page/Tab.php +++ b/CRM/Event/Page/Tab.php @@ -118,11 +118,11 @@ public function preProcess() { $this->_action = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, 'browse'); $this->_id = CRM_Utils_Request::retrieve('id', 'Positive', $this); - if ($context == 'standalone') { + if ($context == 'standalone' || $context === 'search') { $this->_action = CRM_Core_Action::ADD; } else { - $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this, TRUE); + $this->_contactId = CRM_Utils_Request::retrieve('cid', 'Positive', $this); $this->assign('contactId', $this->_contactId); // check logged in url permission diff --git a/templates/CRM/Event/Form/Task/Register.tpl b/templates/CRM/Event/Form/Task/Register.tpl new file mode 100644 index 000000000000..2f1ea14ca4fb --- /dev/null +++ b/templates/CRM/Event/Form/Task/Register.tpl @@ -0,0 +1,12 @@ +{* + +--------------------------------------------------------------------+ + | Copyright CiviCRM LLC. All rights reserved. | + | | + | This work is published under the GNU AGPLv3 license with some | + | permitted exceptions and without any warranty. For full license | + | and copyright information, see https://civicrm.org/licensing | + +--------------------------------------------------------------------+ +*} +{crmScope qfKey=$participantQfKey action=$participantAction} + {include file="CRM/Event/Form/Participant.tpl"} +{/crmScope}