Created
January 4, 2018 03:09
-
-
Save jitendrapurohit/c02d454173bb1cbaec29156a4b6f7e52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/CRM/Contact/BAO/SavedSearch.php b/CRM/Contact/BAO/SavedSearch.php | |
index 04fe04ef7c..2bf4c2e38c 100644 | |
--- a/CRM/Contact/BAO/SavedSearch.php | |
+++ b/CRM/Contact/BAO/SavedSearch.php | |
@@ -92,6 +92,17 @@ class CRM_Contact_BAO_SavedSearch extends CRM_Contact_DAO_SavedSearch { | |
* the values of the posted saved search used as default values in various Search Form | |
*/ | |
public static function getFormValues($id) { | |
+ $fields = array( | |
+ 'event_start_date_low' => 'event_date_low', | |
+ 'event_end_date_high' => 'event_date_high', | |
+ 'participant_register_date_low' => 'participant_date_low', | |
+ 'participant_register_date_high' => 'participant_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'); | |
$result = NULL; | |
if ($fv) { | |
@@ -119,6 +130,11 @@ class CRM_Contact_BAO_SavedSearch extends CRM_Contact_DAO_SavedSearch { | |
$result[$id] = NULL; | |
$result["{$entityName}_date_relative"] = $result['relative_dates'][$entityName]; | |
} | |
+ elseif (!empty($fields[$id])) { | |
+ $entityName = strstr($fields[$id], '_date', TRUE); | |
+ $result[$id] = NULL; | |
+ $result["{$entityName}_relative"] = $result['relative_dates'][$entityName]; | |
+ } | |
else { | |
$result[$id] = $value; | |
$result["{$entityName}_date_relative"] = 0; | |
@@ -411,9 +427,13 @@ LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_ | |
*/ | |
public static function saveRelativeDates(&$queryParams, $formValues) { | |
$relativeDates = array('relative_dates' => array()); | |
+ $extraDateValues = array('event_relative', 'case_from_relative', 'case_to_relative', 'participant_relative'); | |
foreach ($formValues as $id => $value) { | |
- if (preg_match('/_date_relative$/', $id) && !empty($value)) { | |
+ if ((preg_match('/_date_relative$/', $id) || in_array($id, $extraDateValues)) && !empty($value)) { | |
$entityName = strstr($id, '_date', TRUE); | |
+ if (empty($entityName)) { | |
+ $entityName = strstr($id, '_relative', TRUE); | |
+ } | |
$relativeDates['relative_dates'][$entityName] = $value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment