X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContribute%2FForm%2FSearch.php;h=6923169fe6b902cc1ba28a44347e1ea7cdcdd59d;hb=9a26beb7387d6122c1a5db8de652c1e11d6286f2;hp=f3aa40248b8aa5e7f57ffef5e34c4153225b0154;hpb=7abd0f3724d41e929046ee7f1f6975e29bfa210f;p=civicrm-core.git diff --git a/CRM/Contribute/Form/Search.php b/CRM/Contribute/Form/Search.php index f3aa40248b..6923169fe6 100644 --- a/CRM/Contribute/Form/Search.php +++ b/CRM/Contribute/Form/Search.php @@ -86,14 +86,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search { $this->loadStandardSearchOptionsFromUrl(); - // get user submitted values - // get it from controller only if form has been submitted, else preProcess has set this - if (!empty($_POST)) { - $this->_formValues = $this->controller->exportValues($this->_name); - } - else { - $this->_formValues = $this->get('formValues'); - } + $this->_formValues = $this->getFormValues(); //membership ID $memberShipId = CRM_Utils_Request::retrieve('memberId', 'Positive', $this); @@ -106,12 +99,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search { } if ($this->_force) { - // Search field metadata is normally added in buildForm but we are bypassing that in this flow - // (I've always found the flow kinda confusing & perhaps that is the problem but this mitigates) - $this->addSearchFieldMetadata(['Contribution' => CRM_Contribute_BAO_Query::getSearchFieldMetadata()]); - $this->addSearchFieldMetadata(['ContributionRecur' => CRM_Contribute_BAO_ContributionRecur::getContributionRecurSearchFieldMetadata()]); - $this->postProcess(); - $this->set('force', 0); + $this->handleForcedSearch(); } $sortID = NULL; @@ -414,8 +402,6 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search { if (!$this->_force) { return; } - // Start by loading url defaults. - $this->_formValues = $this->setDefaultValues(); $status = CRM_Utils_Request::retrieve('status', 'String'); if ($status) { @@ -484,4 +470,14 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search { return ts('Find Contributions'); } + /** + * Set the metadata for the form. + * + * @throws \CiviCRM_API3_Exception + */ + protected function setSearchMetadata() { + $this->addSearchFieldMetadata(['Contribution' => CRM_Contribute_BAO_Query::getSearchFieldMetadata()]); + $this->addSearchFieldMetadata(['ContributionRecur' => CRM_Contribute_BAO_ContributionRecur::getContributionRecurSearchFieldMetadata()]); + } + }