FIX : [ bug #1317 ] Removing a category does not remove all child categories

This commit is contained in:
Cedric 2014-04-01 16:21:20 +02:00 committed by Laurent Destailleur
parent ab6a67054a
commit a4797a0e4a

View File

@ -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";