Merge pull request #14987 from civicrm/5.16
[civicrm-core.git] / CRM / Contribute / Form / Search.php
index d021b8157ba5956150c790749f29277d225335f8..fe892ed80159347a45f21ac0314f4486fdf465f8 100644 (file)
@@ -109,6 +109,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search {
       // 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);
     }
@@ -169,6 +170,9 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search {
       CRM_Core_Error::deprecatedFunctionWarning('pass receive_date_high not end');
     }
     $this->_defaults = parent::setDefaultValues();
+
+    $this->_defaults = array_merge($this->getEntityDefaults('ContributionRecur'), $this->_defaults);
+
     if (empty($this->_defaults['contribution_status_id']) && !$this->_force) {
       // In force mode only parameters from the url will be used. When visible/ explicit this is a useful default.
       $this->_defaults['contribution_status_id'][1] = CRM_Core_PseudoConstant::getKey(
@@ -284,10 +288,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search {
 
     $this->_done = TRUE;
 
-    if (!empty($_POST) && !$this->_force) {
-      $this->_formValues = $this->controller->exportValues($this->_name);
-    }
-    $this->convertTextStringsToUseLikeOperator();
+    $this->setFormValues();
     $this->fixFormValues();
 
     // We don't show test records in summaries or dashboards
@@ -413,8 +414,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) {