matomo
matomo copied to clipboard
[Bug] Updating scheduled email report fails if goal has been deleted
Steps to reproduce (all in UI):
- Create a goal
- Create a scheduled report using this goal
- Create a new goal
- Delete the old goal
- Open scheduled report
- Select new goal
- Try to save scheduled report
Overserved:
Saving fails with an exception.
Expected
Successful save
This fails due to:
https://github.com/matomo-org/matomo/blob/d0b89d2cf0e58648aa72f4e4214328c10e959fd6/plugins/ScheduledReports/API.php#L826
Suggested solution:
Instead of throwing an exception, unset the respective report from the array.
I tried this locally and it works fine.