Fix #5843 best way fixing
This commit is contained in:
parent
b7b18e3355
commit
298e5cee61
@ -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
|
|||||||
{
|
{
|
||||||
$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
|
|||||||
$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();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user