From 5f3ff0ef1f766cd229f6e24e7dfa550e4af85f24 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Sat, 7 Dec 2019 08:58:32 +1100 Subject: [PATCH] Proper Fix for dev/core#1422 --- CRM/Event/Form/Search.php | 50 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/CRM/Event/Form/Search.php b/CRM/Event/Form/Search.php index 5c6a314c46..704d40b3f4 100644 --- a/CRM/Event/Form/Search.php +++ b/CRM/Event/Form/Search.php @@ -289,7 +289,6 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search { $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues, 0, FALSE, NULL, ['event_id']); - $this->set('formValues', $this->_formValues); $this->set('queryParams', $this->_queryParams); $buttonName = $this->controller->getButtonName(); @@ -382,29 +381,6 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search { // if this search has been forced // then see if there are any get values, and if so over-ride the post values // note that this means that GET over-rides POST :) - $event = CRM_Utils_Request::retrieve('event', 'Positive'); - if ($event) { - $this->_formValues['event_id'] = $event; - $this->_formValues['event_name'] = CRM_Event_PseudoConstant::event($event, TRUE); - } - - $status = CRM_Utils_Request::retrieve('status', 'String'); - - if (isset($status)) { - if ($status === 'true') { - $statusTypes = CRM_Event_PseudoConstant::participantStatus(NULL, "is_counted = 1"); - } - elseif ($status === 'false') { - $statusTypes = CRM_Event_PseudoConstant::participantStatus(NULL, "is_counted = 0"); - } - elseif (is_numeric($status)) { - $statusTypes = (int) $status; - } - elseif (is_array($status) && !array_key_exists('IN', $status)) { - $statusTypes = array_keys($status); - } - $this->_formValues['participant_status_id'] = is_array($statusTypes) ? ['IN' => array_keys($statusTypes)] : $statusTypes; - } $role = CRM_Utils_Request::retrieve('role', 'String'); @@ -465,8 +441,30 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search { * the default array reference */ public function setDefaultValues() { - parent::setDefaultValues(); - return $this->_formValues; + $this->_defaults = parent::setDefaultValues(); + $event = CRM_Utils_Request::retrieve('event', 'Positive'); + if ($event) { + $this->_defaults['event_id'] = $event; + $this->_defaults['event_name'] = CRM_Event_PseudoConstant::event($event, TRUE); + } + + $status = CRM_Utils_Request::retrieve('status', 'String'); + if (isset($status)) { + if ($status === 'true') { + $statusTypes = CRM_Event_PseudoConstant::participantStatus(NULL, "is_counted = 1"); + } + elseif ($status === 'false') { + $statusTypes = CRM_Event_PseudoConstant::participantStatus(NULL, "is_counted = 0"); + } + elseif (is_numeric($status)) { + $statusTypes = (int) $status; + } + elseif (is_array($status) && !array_key_exists('IN', $status)) { + $statusTypes = array_keys($status); + } + $this->_defaults['participant_status_id'] = is_array($statusTypes) ? array_keys($statusTypes) : $statusTypes; + } + return $this->_defaults; } } -- 2.25.1