Moved some code to the new function "reporting_get_planned_downtimes_intervals"