if (empty($_POST[$fieldName])) {
$value = CRM_Utils_Request::retrieveValue($fieldName, $this->getValidationTypeForField($entity, $fieldName), NULL, NULL, 'GET');
if ($value !== NULL) {
- $defaults[$fieldName] = $value;
+ if ($fieldSpec['html']['type'] === 'Select') {
+ $defaults[$fieldName] = explode(',', $value);
+ }
+ else {
+ $defaults[$fieldName] = $value;
+ }
}
if ($fieldSpec['type'] === CRM_Utils_Type::T_DATE || ($fieldSpec['type'] === CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME)) {
$low = CRM_Utils_Request::retrieveValue($fieldName . '_low', 'Timestamp', NULL, NULL, 'GET');
$title,
CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name')
);
- $this->searchFieldMetadata['Contact']['sort_name'] = ['name' => 'sort_name', 'title' => $title, 'type' => CRM_Utils_Type::T_STRING];
+ $this->searchFieldMetadata['Contact']['sort_name'] = array_merge(CRM_Contact_DAO_Contact::fields()['sort_name'], ['name' => 'sort_name', 'title' => $title, 'type' => CRM_Utils_Type::T_STRING]);
}
/**
* Processing needed for buildForm and later.
*
* @return void
+ *
+ * @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
public function preProcess() {
$this->set('searchFormName', 'Search');
$this->_done = FALSE;
- $this->loadStandardSearchOptionsFromUrl();
- $this->loadFormValues();
-
- if ($this->_force) {
- $this->postProcess();
- $this->set('force', 0);
- }
+ parent::preProcess();
$this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues, 0, FALSE, NULL, ['event_id']);
$selector = new CRM_Event_Selector_Search($this->_queryParams,
* @param
*
* @return void
+ * @throws \CRM_Core_Exception
*/
public function postProcess() {
if ($this->_done) {
}
$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);
}
}
}
- /**
- * @return null
- */
- public function getFormValues() {
- return NULL;
- }
-
/**
* Return a descriptive name for the page, used in wizard header
*
$this->_done = FALSE;
- $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');
- }
-
- if ($this->_force) {
- $this->addSearchFieldMetadata(['Membership' => CRM_Member_BAO_Query::getSearchFieldMetadata()]);
- $this->addFormFieldsFromMetadata();
- $this->postProcess();
- $this->set('force', 0);
- }
+ parent::preProcess();
$this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues, 0, FALSE, NULL, $this->entityReferenceFields);
$selector = new CRM_Member_Selector_Search($this->_queryParams,
$this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues, 0, FALSE, NULL, $this->entityReferenceFields);
- $this->set('formValues', $this->_formValues);
$this->set('queryParams', $this->_queryParams);
$buttonName = $this->controller->getButtonName();