avoid duplicate participant custom fields on edit #31064
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
See https://lab.civicrm.org/dev/core/-/issues/5442
Custom participant fields appear twice when editing the participant record.
Before
If you:
Then the custom participant field you created will show up twice.
After
After fixing the javascript in the template, they only appear once.
Technical Details
When there is no event id, we pull in the participant custom fields that apply to all events. That's good.
But, if there is an event id, we again pull in participant custom fields that apply to the given event ID. However, this call includes custom fields that apply to all events as well as custom fields that apply to the given event ID, so any custom fields that apply to all events get pulled in twice.
The fix ensures that we only pull in custom fields once to avoid the duplicates.
@eileenmcnaughton - It's possible this is a regression from e7daf4a but I'm not sure how or why - it just seems like the most recent commit that is touching this code.