From 18db97df1ff0a282921f0357bd2d17c699c4c7d7 Mon Sep 17 00:00:00 2001 From: eileen <emcnaughton@wikimedia.org> Date: Mon, 11 Nov 2019 15:34:53 +1300 Subject: [PATCH] Add setSearchMetadata to each of the classes that extend CRM_Core_Form_Search This doesn't do something in itself but makes it simpler to handled ensuring url_params work & stdises them --- CRM/Activity/Form/Search.php | 7 +++++++ CRM/Event/Form/Search.php | 9 +++++++++ CRM/Grant/Form/Search.php | 9 +++++++++ CRM/Member/Form/Search.php | 15 +++++++++++++++ CRM/Pledge/Form/Search.php | 10 ++++++++++ 5 files changed, 50 insertions(+) diff --git a/CRM/Activity/Form/Search.php b/CRM/Activity/Form/Search.php index 3962a7fadd..87962cffc9 100644 --- a/CRM/Activity/Form/Search.php +++ b/CRM/Activity/Form/Search.php @@ -357,4 +357,11 @@ class CRM_Activity_Form_Search extends CRM_Core_Form_Search { return CRM_Activity_BAO_Query::getSearchFieldMetadata(); } + /** + * Set the metadata for the form. + */ + protected function setSearchMetadata() { + $this->addSearchFieldMetadata(['Activity' => $this->getEntityMetadata()]); + } + } diff --git a/CRM/Event/Form/Search.php b/CRM/Event/Form/Search.php index feb9f1db72..5efeee1262 100644 --- a/CRM/Event/Form/Search.php +++ b/CRM/Event/Form/Search.php @@ -482,4 +482,13 @@ 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()]); + } + } diff --git a/CRM/Grant/Form/Search.php b/CRM/Grant/Form/Search.php index 17e35f59b3..6ce4585751 100644 --- a/CRM/Grant/Form/Search.php +++ b/CRM/Grant/Form/Search.php @@ -293,4 +293,13 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search { return CRM_Grant_BAO_Query::getSearchFieldMetadata(); } + /** + * Set the metadata for the form. + * + * @throws \CiviCRM_API3_Exception + */ + protected function setSearchMetadata() { + $this->addSearchFieldMetadata(['Grant' => $this->getEntityMetadata()]); + } + } diff --git a/CRM/Member/Form/Search.php b/CRM/Member/Form/Search.php index 0c9c2b20e7..f9b9a22f5a 100644 --- a/CRM/Member/Form/Search.php +++ b/CRM/Member/Form/Search.php @@ -74,6 +74,9 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search { /** * Processing needed for buildForm and later. + * + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ public function preProcess() { $this->set('searchFormName', 'Search'); @@ -134,6 +137,9 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search { /** * Build the form object. + * + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ public function buildQuickForm() { parent::buildQuickForm(); @@ -360,4 +366,13 @@ class CRM_Member_Form_Search extends CRM_Core_Form_Search { return ts('Find Memberships'); } + /** + * Set the metadata for the form. + * + * @throws \CiviCRM_API3_Exception + */ + protected function setSearchMetadata() { + $this->addSearchFieldMetadata(['Membership' => CRM_Member_BAO_Query::getSearchFieldMetadata()]); + } + } diff --git a/CRM/Pledge/Form/Search.php b/CRM/Pledge/Form/Search.php index e78c21f409..c4f0bcb59f 100644 --- a/CRM/Pledge/Form/Search.php +++ b/CRM/Pledge/Form/Search.php @@ -391,4 +391,14 @@ class CRM_Pledge_Form_Search extends CRM_Core_Form_Search { return ts('Find Pledges'); } + /** + * Set the metadata for the form. + * + * @throws \CiviCRM_API3_Exception + */ + protected function setSearchMetadata() { + $this->addSearchFieldMetadata(['Pledge' => CRM_Pledge_BAO_Query::getSearchFieldMetadata()]); + $this->addSearchFieldMetadata(['PledgePayment' => CRM_Pledge_BAO_Query::getPledgePaymentSearchFieldMetadata()]); + } + } -- 2.25.1