diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 5a239f5eb216e6fd58675eec907852ce1ab97af7..a49ad862cacfa3bebf01907ad788658ac9dee349 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -290,6 +290,20 @@ class Categorie $this->db->begin(); + /* FIX #1317 : Check for child cat and move up 1 level*/ + if (! $error) + { + $sql = "UPDATE ".MAIN_DB_PREFIX."categorie"; + $sql.= " SET fk_parent = ".$this->fk_parent; + $sql.= " WHERE fk_parent = ".$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_societe";