From: Tim Otten Date: Tue, 8 Dec 2020 05:27:13 +0000 (-0800) Subject: CRM_Event_Form_Task_Register - Fix error "getFieldValue failed" (tentative) X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=21aab5a3f2d0f276a3294a57a52decdd202e41aa;p=civicrm-core.git CRM_Event_Form_Task_Register - Fix error "getFieldValue failed" (tentative) When preparing the event-registration form, `CRM_Event_Page_Tab::preProcess()` looks up the designated contact ID and calls `checkUserPermission()`. The error message is (effectively) reporting that the permission-check fails because there is no contact ID. And this is a legit thing to complain about -- if you're embedding the event-registration form as part of a search-task, then there is no *singular* contact ID. (There is a potentially very long list of contact IDs - which is probably stored/reported some other way.) The permission-check for this context seems like it ought to be different. I labeled the commit (tentative) because I'm not entirely certain that I understand the contract of this route/controller. It has multiple overlapping use-cases, and I'm not certain if I've tracked them all. However, this patch does seem to fix the "getFieldValue failed" problem when running as a search-task. --- diff --git a/CRM/Event/Form/Task/Register.php b/CRM/Event/Form/Task/Register.php index 5d1082c857..6bdcb8ae20 100644 --- a/CRM/Event/Form/Task/Register.php +++ b/CRM/Event/Form/Task/Register.php @@ -76,7 +76,7 @@ class CRM_Event_Form_Task_Register extends CRM_Event_Form_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"); + $this->assign('urlPathVar', "_qf_Participant_display=true&context=search"); } } diff --git a/CRM/Event/Page/Tab.php b/CRM/Event/Page/Tab.php index 0d039cdc1e..47334d4af5 100644 --- a/CRM/Event/Page/Tab.php +++ b/CRM/Event/Page/Tab.php @@ -118,7 +118,7 @@ class CRM_Event_Page_Tab extends CRM_Core_Page { $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 {