Skip to content

Commit

Permalink
Fix failure to save relative dates on legacy fields
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Sep 2, 2019
1 parent 328f7c9 commit 9dbf7ea
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions CRM/Contact/BAO/SavedSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,29 @@ 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
// form format and simply saves (e.g) custom_3_relative => "this.year"
$relativeDates = ['relative_dates' => []];
$specialDateFields = ['event_relative', 'case_from_relative', 'case_to_relative', 'participant_relative', 'log_date_relative'];
$specialDateFields = [
'event_relative',
'case_from_relative',
'case_to_relative',
'participant_relative',
'log_date_relative',
'pledge_payment_date_relative',
'pledge_start_date_relative',
'pledge_end_date_relative',
'pledge_create_date_relative',
'member_join_date_relative',
'member_start_date_relative',
'member_end_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) {
if ((preg_match('/_date$/', $id) || in_array($id, $specialDateFields)) && !empty($value)) {
if (in_array($id, $specialDateFields) && !empty($value)) {
$entityName = strstr($id, '_date', TRUE);
if (empty($entityName)) {
$entityName = strstr($id, '_relative', TRUE);
Expand Down

0 comments on commit 9dbf7ea

Please sign in to comment.