From 3296e48ac60591b6f22c5755afc84009c225fbd0 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 29 Jul 2026 16:36:47 -0400 Subject: [PATCH] Unlink template from recurring ticket if template is deleted --- admin/post/ticket_template.php | 4 ++++ 1 file changed, 4 insertions(+) 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');