From 9a9887f48229e6bcd9dee67c94dacea1de11a936 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Feb 2017 12:14:32 +0100 Subject: [PATCH] Fix deletion of bank category/tag --- htdocs/categories/class/categorie.class.php | 25 +++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 3c4568ae70e..464b9bf3127 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -526,7 +526,17 @@ class Categorie extends CommonObject } if (! $error) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_project"; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_contact"; + $sql .= " WHERE fk_categorie = ".$this->id; + if (!$this->db->query($sql)) + { + $this->error=$this->db->lasterror(); + $error++; + } + } + if (! $error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_account"; $sql .= " WHERE fk_categorie = ".$this->id; if (!$this->db->query($sql)) { @@ -535,7 +545,18 @@ class Categorie extends CommonObject $error++; } } - + if (! $error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."bank_class"; + $sql .= " WHERE fk_categ = ".$this->id; + if (!$this->db->query($sql)) + { + $this->error=$this->db->lasterror(); + dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); + $error++; + } + } + if (! $error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_lang";