Deletion of SMS provider caused all scheduled reminders to fail to be sent
A user recently deleted an SMS provider. Unfortunately there were live SMS scheduled reminders attached to that provider. This caused the cron call to job.send_reminder to fail with the message "Provider not known or not provided". This is a "fatal" error, meaning that the cron job failed immediately, regardless of the fact that there were many perfectly valid reminders which needed processing.
I have a few points to make about this:
- An SMS provider should not be able to be deleted with linked active SMS scheduled reminders, or at least a warning ought to be displayed and the affected reminders automatically disabled.
- The following constraint on the civicrm_action_schedule table looks suspect (I can't see how it could ever lead to anything appropriate happening) - the "ON DELETE SET NULL" directly led to the problem described above:
CONSTRAINT `FK_civicrm_action_schedule_sms_provider_id` FOREIGN KEY (`sms_provider_id`) REFERENCES `civicrm_sms_provider` (`id`) ON DELETE SET NULL
- The "Provider not known or not provided" error ought to be a warning, not a "fatal" error. There is no need for the code to stop proceeding if a provider cannot be found, only that that particular reminder cannot be invoked.