From 9aed9359adc5017d31de8e2169d225f412ce4b1d Mon Sep 17 00:00:00 2001 From: Supermanu Date: Sat, 4 May 2019 12:22:45 +0200 Subject: [PATCH] FIX: Remove link between categories and project when deleting --- htdocs/projet/class/project.class.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 09eadbbc8ea..8ebe6f71425 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -688,6 +688,18 @@ class Project extends CommonObject } } + // Remove linked categories. + if (! $error) { + $sql = "DELETE FROM ".MAIN_DB_PREFIX. "categorie_project"; + $sql.= " WHERE fk_project = ". $this->id; + + $result = $this->db->query($sql); + if (! $result) { + $error++; + $this->errors[] = $this->db->lasterror(); + } + } + // Fetch tasks $this->getLinesArray($user);