Skip to content
Snippets Groups Projects
Commit 298e5cee authored by Juanjo Menent's avatar Juanjo Menent
Browse files

Fix #5843 best way fixing

parent b7b18e33
No related branches found
No related tags found
No related merge requests found
...@@ -558,6 +558,7 @@ class Categorie extends CommonObject ...@@ -558,6 +558,7 @@ class Categorie extends CommonObject
global $user,$langs,$conf; global $user,$langs,$conf;
$error=0; $error=0;
$trigger=true;
if ($this->id == -1) return -2; if ($this->id == -1) return -2;
...@@ -598,12 +599,16 @@ class Categorie extends CommonObject ...@@ -598,12 +599,16 @@ class Categorie extends CommonObject
{ {
$cat = new Categorie($this->db); $cat = new Categorie($this->db);
$cat->id=$objparent->fk_parent; $cat->id=$objparent->fk_parent;
$result=$cat->add_type($obj, $type);
if ($result < 0) if (! $cat->containsObject($type,$obj->id)) {
{ $result=$cat->add_type($obj, $type);
$this->error=$cat->error; if ($result < 0) {
$error++; $this->error=$cat->error;
} $error++;
}
} else {
$trigger=false;
}
} }
} }
} }
...@@ -624,10 +629,13 @@ class Categorie extends CommonObject ...@@ -624,10 +629,13 @@ class Categorie extends CommonObject
$this->linkto=$obj; $this->linkto=$obj;
// Call trigger // Call trigger
$result=$this->call_trigger('CATEGORY_LINK',$user); if ($trigger) {
if ($result < 0) { $error++; } $result = $this->call_trigger('CATEGORY_LINK', $user);
// End call triggers if ($result < 0) {
$error++;
}
// End call triggers
}
if (! $error) if (! $error)
{ {
$this->db->commit(); $this->db->commit();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment