From 58d67c0922a3ac86e20f6b0ed547c067bd9b2067 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 8 Sep 2022 11:52:10 +0200 Subject: [PATCH] fix #22145 : impossible to delete ticket --- htdocs/ticket/class/ticket.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 9ee7d2c81b6..9c95e56870a 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1016,6 +1016,19 @@ class Ticket extends CommonObject } } + // Delete all child tables + + if (!$error) { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_ticket"; + $sql .= " WHERE fk_ticket = ".(int) $this->id; + + $result = $this->db->query($sql); + if (!$result) { + $error++; + $this->errors[] = $this->db->lasterror(); + } + } + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."ticket"; $sql .= " WHERE rowid=".((int) $this->id);