Scheduled reminders won't save when participant field is cleared
Overview
When an event scheduled reminder is created, and then edited, CiviCRM does not fully clear the "Recipient Roles" field and then throws an error saying a value is required even if "Recipients" and "Recipient Roles" field is now blank. This prevents saving the edited scheduled reminder.
The workaround is to delete the scheduled reminder and re-create it.
This problem also arises when upgrading from older versions of CiviCRM that did not have the Recipients and Recipient Role fields. Upon upgrading, these fields are blank, but edits to the schedule reminder cannot be saved due to the same error message appearing.
Reproduction steps
- Create a scheduled reminder. Fill in Recipients and Recipient Role fields. Save.
- Edit scheduled reminder. Change Recipients to blank. The "Recipient Roles" field also goes blank as it should.
- Try to save. You will get an error that the Recipient Roles field requires a value. This is incorrect.
Reproduced on dmaster.
Screenshots to reproduce:
Initial configuration of scheduled reminder.
Edit scheduled reminder and click X to clear participant role:
Recipient role field is appropriately cleared:
But trying to save generates an error:
Current behaviour
See screenshots above.
Expected behaviour
When Recipients field is blank, Recipient Roles field should be blanked (which happens) and should no longer be required (which does not happen).
Environment information
Reproduced on dmaster on 5.71.alpha1. Also occurs on 5.68.1.