reform MEMBER_VALIDATE and MEMBER_MODIFY code correctly

This commit is contained in:
Timoté Fallais 2019-02-13 14:57:37 +01:00
parent a115b1da7f
commit 9a28c12781

View File

@ -99,12 +99,10 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers
} }
// Members // Members
elseif ($action == 'MEMBER_VALIDATE' || $action == 'MEMBER_MODIFY') elseif ($action == 'MEMBER_VALIDATE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if($action == 'MEMBER_VALIDATE')
{
$return=0; $return=0;
if ($object->add_to_abo() < 0) if ($object->add_to_abo() < 0)
{ {
@ -116,9 +114,13 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers
{ {
$return=1; $return=1;
} }
return $return;
} }
else elseif ($action == 'MEMBER_MODIFY')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$return=0; $return=0;
// Add user into some linked tools (mailman, spip, etc...) // Add user into some linked tools (mailman, spip, etc...)
if (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid)) if (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid))
@ -147,7 +149,6 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers
{ {
$return=1; $return=1;
} }
}
} }
return $return; return $return;