24 require_once DOL_DOCUMENT_ROOT.
'/core/triggers/dolibarrtriggers.class.php';
41 $this->
name = preg_replace(
'/^Interface/i',
'', get_class($this));
42 $this->family =
"mailmanspip";
43 $this->
description =
"Triggers of this module allows to synchronize Mailman an Spip.";
45 $this->version = self::VERSION_DOLIBARR;
46 $this->picto =
'technic';
62 if (empty($conf->mailmanspip) || empty($conf->mailmanspip->enabled)) {
66 require_once DOL_DOCUMENT_ROOT.
"/mailmanspip/class/mailmanspip.class.php";
67 require_once DOL_DOCUMENT_ROOT.
"/user/class/usergroup.class.php";
69 if ($action ==
'CATEGORY_LINK') {
70 dol_syslog(
"Trigger '".$this->
name.
"' for action '$action' launched by ".__FILE__.
". id=".$object->id);
73 if (is_object($object->context[
'linkto']) && method_exists($object->context[
'linkto'],
'add_to_abo') && $object->context[
'linkto']->add_to_abo() < 0) {
74 $this->error = $object->context[
'linkto']->error;
75 $this->errors = $object->context[
'linkto']->errors;
82 } elseif ($action ==
'CATEGORY_UNLINK') {
83 dol_syslog(
"Trigger '".$this->
name.
"' for action '$action' launched by ".__FILE__.
". id=".$object->id);
86 if (is_object($object->context[
'unlinkoff']) && method_exists($object->context[
'unlinkoff'],
'del_to_abo') && $object->context[
'unlinkoff']->del_to_abo() < 0) {
87 $this->error = $object->context[
'unlinkoff']->error;
88 $this->errors = $object->context[
'unlinkoff']->errors;
95 } elseif ($action ==
'MEMBER_VALIDATE') {
97 dol_syslog(
"Trigger '".$this->
name.
"' for action '$action' launched by ".__FILE__.
". id=".$object->id);
100 if ($object->add_to_abo() < 0) {
101 $this->errors = $object->errors;
102 if (!empty($object->error)) {
103 $this->errors[] = $object->error;
111 } elseif ($action ==
'MEMBER_MODIFY') {
112 dol_syslog(
"Trigger '".$this->
name.
"' for action '$action' launched by ".__FILE__.
". id=".$object->id);
116 if (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid)) {
117 if (is_object($object->oldcopy) && (($object->oldcopy->email != $object->email) || ($object->oldcopy->typeid != $object->typeid))) {
118 if ($object->oldcopy->del_to_abo() < 0) {
119 $this->errors = $object->oldcopy->errors;
120 if (!empty($object->oldcopy->error)) {
121 $this->errors[] = $object->oldcopy->error;
129 if ($object->add_to_abo() < 0) {
130 $this->errors = $object->errors;
131 if (!empty($object->error)) {
132 $this->errors[] = $object->error;
141 } elseif ($action ==
'MEMBER_RESILIATE' || $action ==
'MEMBER_DELETE') {
142 dol_syslog(
"Trigger '".$this->
name.
"' for action '$action' launched by ".__FILE__.
". id=".$object->id);
146 if ($object->del_to_abo() < 0) {
147 $this->errors = $object->errors;
148 if (!empty($object->error)) {
149 $this->errors[] = $object->error;
Class to stock current configuration.
Class that all the triggers must extend.
Class of triggers for MailmanSpip module.
runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
Function called when a Dolibarrr business event is done.
__construct($db)
Constructor.
Class to manage translations.
Class to manage Dolibarr users.
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$conf db name
Only used if Module[ID]Name translation string is not found.
$conf db
API class for accounts.