From f5c2dfd8e765cd31d04498aa4e9dacabf5460c37 Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Thu, 28 May 2015 16:03:25 -0500 Subject: [PATCH] Disconnect events from thread when deleting --- include/class.template.php | 3 +-- include/class.thread.php | 3 +++ include/class.ticket.php | 8 -------- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/include/class.template.php b/include/class.template.php index 18c045487..f3a459f6d 100644 --- a/include/class.template.php +++ b/include/class.template.php @@ -161,8 +161,7 @@ class EmailTemplateGroup { 'task.overdue.alert'=>array( 'group'=>'c.task', 'name'=>/* @trans */ 'Overdue Task Alert', - 'desc'=>/* @trans */ 'Alert sent to agents on stale or overdue - task.', + 'desc'=>/* @trans */ 'Alert sent to agents on stale or overdue task.', ), ); diff --git a/include/class.thread.php b/include/class.thread.php index 7572ffdd5..e5a78cde2 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -499,6 +499,9 @@ class Thread extends VerySimpleModel { $this->entries->delete(); + // Null out the events + $this->events->update(array('thread_id' => 0)); + return true; } diff --git a/include/class.ticket.php b/include/class.ticket.php index ff6c549e4..3a48f7db8 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -144,14 +144,6 @@ class TicketModel extends VerySimpleModel { )); } - function delete() { - - if (($ticket=Ticket::lookup($this->getId())) && @$ticket->delete()) - return true; - - return false; - } - static function registerCustomData(DynamicForm $form) { if (!isset(static::$meta['joins']['cdata+'.$form->id])) { $cdata_class = <<<EOF -- GitLab