reform MEMBER_VALIDATE and MEMBER_MODIFY code correctly
This commit is contained in:
parent
a115b1da7f
commit
9a28c12781
@ -99,13 +99,46 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
if($action == 'MEMBER_VALIDATE')
|
||||
$return=0;
|
||||
if ($object->add_to_abo() < 0)
|
||||
{
|
||||
$return=0;
|
||||
if (! empty($object->error)) $this->error=$object->error;
|
||||
$this->errors=$object->errors;
|
||||
$return=-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$return=1;
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
elseif ($action == 'MEMBER_MODIFY')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
$return=0;
|
||||
// Add user into some linked tools (mailman, spip, etc...)
|
||||
if (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid))
|
||||
{
|
||||
if (is_object($object->oldcopy) && (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid))) // If email has changed or if list has changed we delete mailman subscription for old email
|
||||
{
|
||||
if ($object->oldcopy->del_to_abo() < 0)
|
||||
{
|
||||
if (! empty($object->oldcopy->error)) $this->error=$object->oldcopy->error;
|
||||
$this->errors=$object->oldcopy->errors;
|
||||
$return=-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$return=1;
|
||||
}
|
||||
}
|
||||
// We add subscription if new email or new type (new type may means more mailing-list to subscribe)
|
||||
if ($object->add_to_abo() < 0)
|
||||
{
|
||||
if (! empty($object->error)) $this->error=$object->error;
|
||||
@ -117,38 +150,6 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers
|
||||
$return=1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$return=0;
|
||||
// Add user into some linked tools (mailman, spip, etc...)
|
||||
if (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid))
|
||||
{
|
||||
if (is_object($object->oldcopy) && (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid))) // If email has changed or if list has changed we delete mailman subscription for old email
|
||||
{
|
||||
if ($object->oldcopy->del_to_abo() < 0)
|
||||
{
|
||||
if (! empty($object->oldcopy->error)) $this->error=$object->oldcopy->error;
|
||||
$this->errors=$object->oldcopy->errors;
|
||||
$return=-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$return=1;
|
||||
}
|
||||
}
|
||||
// We add subscription if new email or new type (new type may means more mailing-list to subscribe)
|
||||
if ($object->add_to_abo() < 0)
|
||||
{
|
||||
if (! empty($object->error)) $this->error=$object->error;
|
||||
$this->errors=$object->errors;
|
||||
$return=-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$return=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user