Fix #5843 best way fixing

This commit is contained in:
Juanjo Menent 2016-10-07 22:54:08 +02:00
parent 45dfb8ca62
commit ffd486e3d6

View File

@ -590,23 +590,24 @@ class Categorie extends CommonObject
$resql=$this->db->query($sql); $resql=$this->db->query($sql);
if ($resql) if ($resql)
{ {
if ($this->db->num_rows($resql) > 0) { if ($this->db->num_rows($resql) > 0)
{
$objparent = $this->db->fetch_object($resql); $objparent = $this->db->fetch_object($resql);
if (!empty($objparent->fk_parent)) { if (!empty($objparent->fk_parent))
$cat = new Categorie($this->db); {
$cat->id = $objparent->fk_parent; $cat = new Categorie($this->db);
$cat->id = $objparent->fk_parent;
if (!$cat->containsObject($type, $obj->id)) { if (!$cat->containsObject($type, $obj->id)) {
$result = $cat->add_type($obj, $type); $result = $cat->add_type($obj, $type);
if ($result < 0) { if ($result < 0)
$this->error = $cat->error; {
$error++; $this->error = $cat->error;
} $error++;
}
} }
} }
} }
} }
else else
{ {