From what I can tell it's possible to create smart groups from Advanced search & other contact searchs & Membership Search & Event search.
Membership search actually just leverages advanced search but Event Search smart group has it's own code & reloads into Event search.
This has been flawed for months but the current iteration is the criteria are not respected. On digging I found the decision was made in
contact search to store the parsed QueryParams (in [field_name, 'IN', [1,2]] format not the formValues. I think this was probably a mistake.
However, by adjusting the event code to do the same & ensuring the defaults are set it starts working again
}
$this->_done = TRUE;
- $formValues = $this->getFormValues();
+ $this->setFormValues();
- $this->submit($formValues);
+ $this->submit($this->_formValues);
}
/**
* the default array reference
*/
public function setDefaultValues() {
- $this->_defaults = parent::setDefaultValues();
+ $this->_defaults = array_merge(parent::setDefaultValues(), (array) $this->_formValues);
$event = CRM_Utils_Request::retrieve('event', 'Positive');
if ($event) {
$this->_defaults['event_id'] = $event;
// saved search form values
$formValues = $this->controller->exportValues();
- $session = CRM_Core_Session::singleton();
-
//save the search
$savedSearch = new CRM_Contact_BAO_SavedSearch();
$savedSearch->id = $this->_id;
- $savedSearch->form_values = serialize($this->get('formValues'));
+ $savedSearch->form_values = serialize($this->get('queryParams'));
$savedSearch->save();
$this->set('ssID', $savedSearch->id);
CRM_Core_Session::setStatus(ts("Your smart group has been saved as '%1'.", [1 => $formValues['title']]), ts('Saved'), 'success');