Event template scheduled reminders lost when creating a new event using API4
Overview
Scheduled reminders from an event template are lost when creating a new event using API4 with the template id
parameter.
The scheduled reminders are copied, but don't get properly attached to the event.
It seems to work fine if creating an event from template using the admin screens.
Reproduction steps
- Create an event template with one or more scheduled reminders configured on it
- Check the id for your new template
- Use API4 to create a new event from the template, using the
template_id
parameter - Check your new event - it won't have any scheduled reminders
Current behaviour
The reminders for the new event are half-created — they show in Administer >> Communications >> Schedule Reminders but but they aren't attached to anything. The issue seems to be they get copied as Event Template reminders and don't get updated to be Event reminders.
(Top row is the original reminder on the template. Second is the 'orphaned' reminder. Third is the successfully copied reminder on event created from template through the web UI)
Expected behaviour
The reminders should be attached to the new event.
Environment information
- CiviCRM: dmaster on buildkit 5.50.alpha1 (and previous versions since a while)
- PHP: 7.4
- CMS: Drupal
Comments
I have a patch that seems to resolve though feels a bit hacky. The event schedule reminder code is a bit sticky...