(dev/core#1226) Fix failure to save relative dates on legacy fields #15194
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Fixes a 5.16 regression whereby smart groups relative dates are converted to fixed dates for smart groups created on 5.16 with one of the affected fields in them.
This is an expansion of the previous update #15169.
Before
Groups with the fields
'log_date_relative',
'pledge_payment_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',
on 5.16 are created with the dates converted to fixed dates
After
Saves as relative dates
Technical Details
The regex was wrong in this change
7f17570#diff-54576153cb6a72d6ea7e22a5e8ca63f2R442
This switches to a whitelist of remaining legacy dates
Once merged to master a PR on master would remove converted fields from the list
Comments
I noticed that the custom fields are added differently for Contact custom fields and non-contact custom fields & non contact custom fields are using the jcalendar dates & likely didn't work before or after this. We should fix them. The Contact_BAO_Query object and the others don't have a shared parent & hence have 2 different functions. I think they should have a shared parent & Contact_BAO_Query should share with the others - if existing functions make that hard we can use a trait