issue#5726 : Revert "Fix ActionSchedule save on repeat events" #32255
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
https://lab.civicrm.org/dev/core/-/issues/5726
Before
On using 'Repeat Activity' at the bottom of the Activity edit screen and save, you get the following error and only the original Activity is saved:
After
Correctly saved.
Technical Details
This reverts commit 0f589cef49495bebcd1fb97ba5ef76385bd9586b . It works with
CRM_Core_BAO_ActionSchedule::writeRecord()
because it doesn't pass through validator but when we use save action it eventually hits the validator and throw the error message:It failed for mapping_id and start_action_unit values because these have following
required_if
condition:empty($values.used_for) || $values.used_for !== "civicrm_event"
empty($values.absolute_date) && (empty($values.used_for) || $values.used_for !== "civicrm_event")
The actual record which is passed to
ActionSchedule::save
action here is :I think that required_if condition is bit incorrect in this case as we have the user_for value but since its not civicrm_event it will always fail and and the start_action_unit should also check for start_action_date along with absolute date ?
So I suppose the validators should be :
empty($values.used_for) || ($values.used_for !== "civicrm_event" && $values.used_for !== "civicrm_activity")
empty($values.absolute_date) && empty($values.start_action_date) && (empty($values.used_for) || ($values.used_for !== "civicrm_event" && $values.used_for !== "civicrm_activity"))
If you agree with this logic I will submit a separate PR against master and submit another PR dependent on it restore Eilieen;s commit.
Comments
ping @colemanw @eileenmcnaughton @seamuslee001