diff --git a/admin/post/ticket_template.php b/admin/post/ticket_template.php index 24e660f4..eac63e6e 100644 --- a/admin/post/ticket_template.php +++ b/admin/post/ticket_template.php @@ -68,6 +68,10 @@ if (isset($_GET['delete_ticket_template'])) { mysqli_query($mysqli, "DELETE FROM task_templates WHERE task_template_ticket_template_id = $ticket_template_id"); mysqli_query($mysqli, "DELETE FROM project_template_ticket_templates WHERE ticket_template_id = $ticket_template_id"); + // Unlink from recurring tickets rather than deleting them - the schedule is still + // wanted, it just stops contributing tasks to the tickets it raises + mysqli_query($mysqli, "UPDATE recurring_tickets SET recurring_ticket_ticket_template_id = 0 WHERE recurring_ticket_ticket_template_id = $ticket_template_id"); + logAudit("Ticket Template", "Delete", "$session_name deleted ticket template $ticket_template_name"); flashAlert("Ticket Template $ticket_template_name and its associated tasks deleted", 'error');