From b33c0edc5fdf8ae36a63dea7c1ae62d0f7ff9f1c Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 4 Dec 2020 23:29:28 -0800 Subject: [PATCH] Event Registration Task - Propagate different qfKey & action for AJAX URLs When use the search-task to register event participants, the qfKey is mismatched, and the action is VIEW. It should be ADD, and the qfKey should be for CRM_Event_Form_Participant. --- CRM/Event/Form/Task/Register.php | 6 +++++- CRM/Event/Page/Tab.php | 2 +- templates/CRM/Event/Form/Task/Register.tpl | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CRM/Event/Form/Task/Register.php b/CRM/Event/Form/Task/Register.php index e9ca978c2f..5d1082c857 100644 --- a/CRM/Event/Form/Task/Register.php +++ b/CRM/Event/Form/Task/Register.php @@ -72,7 +72,11 @@ class CRM_Event_Form_Task_Register extends CRM_Event_Form_Participant { //set ajax path, this used for custom data building $this->assign('urlPath', 'civicrm/contact/view/participant'); - $this->assign('urlPathVar', "_qf_Participant_display=true&qfKey={$this->controller->_key}"); + + $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"); } } diff --git a/CRM/Event/Page/Tab.php b/CRM/Event/Page/Tab.php index 2c75b80d2d..0d039cdc1e 100644 --- a/CRM/Event/Page/Tab.php +++ b/CRM/Event/Page/Tab.php @@ -90,7 +90,7 @@ class CRM_Event_Page_Tab extends CRM_Core_Page { $controller = new CRM_Core_Controller_Simple( 'CRM_Event_Form_Participant', 'Create Participation', - $this->_action, FALSE, FALSE, TRUE + $this->_action ); $controller->setEmbedded(TRUE); diff --git a/templates/CRM/Event/Form/Task/Register.tpl b/templates/CRM/Event/Form/Task/Register.tpl index 6fa18c56bf..2f1ea14ca4 100644 --- a/templates/CRM/Event/Form/Task/Register.tpl +++ b/templates/CRM/Event/Form/Task/Register.tpl @@ -7,4 +7,6 @@ | and copyright information, see https://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -{include file="CRM/Event/Form/Participant.tpl"} +{crmScope qfKey=$participantQfKey action=$participantAction} + {include file="CRM/Event/Form/Participant.tpl"} +{/crmScope} -- 2.25.1