X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FEvent%2FForm%2FSearch.php;fp=CRM%2FEvent%2FForm%2FSearch.php;h=5c6a314c46850d16cd0ef2d328903e200ef2183d;hb=1ba43e8d0d271e4c3b4d84fb7f519c55329981ab;hp=abf22b7a25c58d2947ba87a6bb23d9cea581e4f6;hpb=e626223465117c76f51ae5a3a1e78be4067a1247;p=civicrm-core.git diff --git a/CRM/Event/Form/Search.php b/CRM/Event/Form/Search.php index abf22b7a25..5c6a314c46 100644 --- a/CRM/Event/Form/Search.php +++ b/CRM/Event/Form/Search.php @@ -1,34 +1,18 @@ set('searchFormName', 'Search'); @@ -102,20 +89,7 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search { $this->_done = FALSE; - $this->loadStandardSearchOptionsFromUrl(); - $this->loadFormValues(); - - if ($this->_force) { - $this->postProcess(); - $this->set('force', 0); - } - - $sortID = NULL; - if ($this->get(CRM_Utils_Sort::SORT_ID)) { - $sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), - $this->get(CRM_Utils_Sort::SORT_DIRECTION) - ); - } + parent::preProcess(); $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues, 0, FALSE, NULL, ['event_id']); $selector = new CRM_Event_Selector_Search($this->_queryParams, @@ -135,7 +109,7 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search { $controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), - $sortID, + $this->getSortID(), CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::TRANSFER, @@ -329,13 +303,6 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search { return; } - $sortID = NULL; - if ($this->get(CRM_Utils_Sort::SORT_ID)) { - $sortID = CRM_Utils_Sort::sortIDValue($this->get(CRM_Utils_Sort::SORT_ID), - $this->get(CRM_Utils_Sort::SORT_DIRECTION) - ); - } - $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues, 0, FALSE, NULL, ['event_id']); $selector = new CRM_Event_Selector_Search($this->_queryParams, @@ -358,7 +325,7 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search { $controller = new CRM_Core_Selector_Controller($selector, $this->get(CRM_Utils_Pager::PAGE_ID), - $sortID, + $this->getSortID(), CRM_Core_Action::VIEW, $this, CRM_Core_Selector_Controller::SESSION, @@ -388,6 +355,7 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search { * @param * * @return void + * @throws \CRM_Core_Exception */ public function postProcess() { if ($this->_done) { @@ -395,16 +363,7 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search { } $this->_done = TRUE; - $formValues = []; - - if (!empty($_POST)) { - $formValues = $this->controller->exportValues($this->_name); - CRM_Contact_BAO_Query::processSpecialFormValue($this->_formValues, ['participant_status_id']); - } - - if (empty($formValues)) { - $formValues = $this->controller->exportValues($this->_name); - } + $formValues = $this->getFormValues(); $this->submit($formValues); } @@ -480,13 +439,6 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search { } } - /** - * @return null - */ - public function getFormValues() { - return NULL; - } - /** * Return a descriptive name for the page, used in wizard header * @@ -496,6 +448,15 @@ class CRM_Event_Form_Search extends CRM_Core_Form_Search { return ts('Find Participants'); } + /** + * Set the metadata for the form. + * + * @throws \CiviCRM_API3_Exception + */ + protected function setSearchMetadata() { + $this->addSearchFieldMetadata(['Participant' => CRM_Event_BAO_Query::getSearchFieldMetadata()]); + } + /** * Set the default form values. *