/**
* Processing needed for buildForm and later.
+ *
+ * @throws \CiviCRM_API3_Exception
+ * @throws \CRM_Core_Exception
*/
public function preProcess() {
$this->set('searchFormName', '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);
}
CRM_Core_Error::deprecatedFunctionWarning('pass receive_date_high not end');
}
$this->_defaults = parent::setDefaultValues();
- if (empty($this->_defaults['contribution_status'])) {
- $this->_defaults['contribution_status'][1] = 1;
+
+ $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(
+ 'CRM_Contribute_BAO_Contribution',
+ 'contribution_status_id',
+ 'Completed'
+ );
}
return $this->_defaults;
}
$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