From 8fc5faf4a843d801e3517399b70ea4e7b17cd125 Mon Sep 17 00:00:00 2001 From: BadPixxel Date: Mon, 10 Nov 2014 16:29:05 +0100 Subject: [PATCH] Minor BugFix : Missing delete Category Multilangual fields Delete of Multilangual fields was missing, impossible to delete category. Fixed Error : Cannot delete or update a parent row: a foreign key constraint fails (`Dol-3.6`.`llx_categorie_lang`, CONSTRAINT `fk_category_lang_fk_category` FOREIGN KEY (`fk_category`) REFERENCES `llx_categorie` (`rowid`)) --- htdocs/categories/class/categorie.class.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index af16ca2d28ee7..a504b71b42e38 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -408,7 +408,18 @@ function delete($user) $error++; } } - + if (! $error) + { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_lang"; + $sql .= " WHERE fk_category = ".$this->id; + if (!$this->db->query($sql)) + { + $this->error=$this->db->lasterror(); + dol_syslog("Error sql=".$sql." ".$this->error, LOG_ERR); + $error++; + } + } + // Delete category if (! $error) {