mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
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;
|
||||
|
||||
$error=0;
|
||||
$trigger=true;
|
||||
|
||||
if ($this->id == -1) return -2;
|
||||
|
||||
|
|
@ -598,12 +599,16 @@ class Categorie extends CommonObject
|
|||
{
|
||||
$cat = new Categorie($this->db);
|
||||
$cat->id=$objparent->fk_parent;
|
||||
$result=$cat->add_type($obj, $type);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->error=$cat->error;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $cat->containsObject($type,$obj->id)) {
|
||||
$result=$cat->add_type($obj, $type);
|
||||
if ($result < 0) {
|
||||
$this->error=$cat->error;
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
$trigger=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -624,10 +629,13 @@ class Categorie extends CommonObject
|
|||
$this->linkto=$obj;
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CATEGORY_LINK',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
|
||||
if ($trigger) {
|
||||
$result = $this->call_trigger('CATEGORY_LINK', $user);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
}
|
||||
// End call triggers
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user