$specialDateFields = [
'event_start_date_low' => 'event_date_low',
'event_end_date_high' => 'event_date_high',
- 'case_from_start_date_low' => 'case_from_date_low',
- 'case_from_start_date_high' => 'case_from_date_high',
- 'case_to_end_date_low' => 'case_to_date_low',
- 'case_to_end_date_high' => 'case_to_date_high',
];
$fv = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_SavedSearch', $id, 'form_values');
}
}
- /**
- * Given a saved search compute the clause and the tables and store it for future use.
- */
- public function buildClause() {
- $fv = unserialize($this->form_values);
-
- if ($this->mapping_id) {
- $params = CRM_Core_BAO_Mapping::formattedFields($fv);
- }
- else {
- $params = CRM_Contact_BAO_Query::convertFormValues($fv);
- }
-
- if (!empty($params)) {
- $tables = $whereTables = [];
- $this->where_clause = CRM_Contact_BAO_Query::getWhereClause($params, NULL, $tables, $whereTables);
- if (!empty($tables)) {
- $this->select_tables = serialize($tables);
- }
- if (!empty($whereTables)) {
- $this->where_tables = serialize($whereTables);
- }
- }
- }
-
- /**
- * Save the search.
- *
- * @param bool $hook
- */
- public function save($hook = TRUE) {
- // first build the computed fields
- $this->buildClause();
-
- parent::save($hook);
- }
-
/**
* Given an id, get the name of the saved search.
*
*
* @param array $queryParams
* @param array $formValues
+ * @deprecated
*/
public static function saveRelativeDates(&$queryParams, $formValues) {
// This is required only until all fields are converted to datepicker fields as the new format is truer to the
$relativeDates = ['relative_dates' => []];
$specialDateFields = [
'event_relative',
- 'case_from_relative',
- 'case_to_relative',
- 'participant_relative',
'log_date_relative',
- 'birth_date_relative',
- 'deceased_date_relative',
- 'mailing_date_relative',
- 'relation_date_relative',
- 'relation_start_date_relative',
- 'relation_end_date_relative',
'relation_action_date_relative',
];
foreach ($formValues as $id => $value) {