FIX Parameters to triggers must be set into $this->context array.

This commit is contained in:
Laurent Destailleur 2018-05-05 13:44:49 +02:00
parent bdf4c0704b
commit 363eaf0d72
2 changed files with 5 additions and 7 deletions

View File

@ -761,11 +761,9 @@ class Categorie extends CommonObject
dol_syslog(get_class($this).'::del_type', LOG_DEBUG);
if ($this->db->query($sql))
{
// Save object we want to unlink category off into category instance to provide information to trigger
$this->unlinkoff=$obj;
// Call trigger
$result=$this->call_trigger('CATEGORY_UNLINK',$user);
$this->context=array('unlinkoff'=>$obj); // Save object we want to link category to into category instance to provide information to trigger
$result=$this->call_trigger('CATEGORY_UNLINK',$user);
if ($result < 0) { $error++; }
// End call triggers

View File

@ -75,10 +75,10 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
// We remove subscription if we change category (lessw category may means less mailing-list to subscribe)
if (is_object($object->unlinkoff) && method_exists($object->unlinkoff, 'del_to_abo') && $object->unlinkoff->del_to_abo() < 0)
if (is_object($object->context['unlinkoff']) && method_exists($object->context['unlinkoff'], 'del_to_abo') && $object->context['unlinkoff']->del_to_abo() < 0)
{
$this->error=$object->unlinkoff->error;
$this->errors=$object->unlinkoff->errors;
$this->error=$object->context['unlinkoff']->error;
$this->errors=$object->context['unlinkoff']->errors;
$return=-1;
}
else