From dc834ae0f5150920a314607a6b91c821612fc6f5 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Mon, 16 Mar 2015 13:41:13 -0500
Subject: [PATCH] cdata: Drop ticket cdata on delete

---
 include/class.ticket.php | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/class.ticket.php b/include/class.ticket.php
index e7546870e..96b585c20 100644
--- a/include/class.ticket.php
+++ b/include/class.ticket.php
@@ -2060,6 +2060,11 @@ class Ticket {
 
         $this->deleteDrafts();
 
+        $sql = 'DELETE FROM '.TICKET_TABLE.'__cdata WHERE `ticket_id`='
+            .db_input($this->getId());
+        // If the CDATA table doesn't exist, that's not an error
+        db_query($sql, false);
+
         // Log delete
         $log = sprintf(__('Ticket #%1$s deleted by %2$s'),
                 $this->getNumber(),
-- 
GitLab