26require_once DOL_DOCUMENT_ROOT.
'/core/triggers/dolibarrtriggers.class.php';
43 $this->
name = preg_replace(
'/^Interface/i',
'', get_class($this));
44 $this->family =
"mailmanspip";
45 $this->
description =
"Triggers of this module allows to synchronize Mailman an Spip.";
46 $this->version = self::VERSIONS[
'prod'];
47 $this->picto =
'technic';
63 if (empty(
$conf->mailmanspip) || empty(
$conf->mailmanspip->enabled)) {
67 require_once DOL_DOCUMENT_ROOT.
"/mailmanspip/class/mailmanspip.class.php";
68 require_once DOL_DOCUMENT_ROOT.
"/user/class/usergroup.class.php";
70 if ($action ==
'CATEGORY_LINK') {
71 dol_syslog(
"Trigger '".$this->
name.
"' for action '$action' launched by ".__FILE__.
". id=".
$object->id);
74 if (is_object(
$object->context[
'linkto']) && method_exists(
$object->context[
'linkto'],
'add_to_abo') &&
$object->context[
'linkto']->add_to_abo() < 0) {
75 $this->error =
$object->context[
'linkto']->error;
76 $this->errors =
$object->context[
'linkto']->errors;
83 } elseif ($action ==
'CATEGORY_UNLINK') {
84 dol_syslog(
"Trigger '".$this->
name.
"' for action '$action' launched by ".__FILE__.
". id=".
$object->id);
87 if (is_object(
$object->context[
'unlinkoff']) && method_exists(
$object->context[
'unlinkoff'],
'del_to_abo') &&
$object->context[
'unlinkoff']->del_to_abo() < 0) {
88 $this->error =
$object->context[
'unlinkoff']->error;
89 $this->errors =
$object->context[
'unlinkoff']->errors;
96 } elseif ($action ==
'MEMBER_VALIDATE') {
98 dol_syslog(
"Trigger '".$this->
name.
"' for action '$action' launched by ".__FILE__.
". id=".
$object->id);
101 if (
$object->add_to_abo() < 0) {
102 $this->errors =
$object->errors;
104 $this->errors[] =
$object->error;
112 } elseif ($action ==
'MEMBER_MODIFY') {
113 dol_syslog(
"Trigger '".$this->
name.
"' for action '$action' launched by ".__FILE__.
". id=".
$object->id);
120 $tmpmember =
new Adherent($this->db);
121 $tmpmember->fetch(
$object->oldcopy->id);
122 if ($tmpmember->del_to_abo() < 0) {
123 $this->errors = $tmpmember->errors;
124 if (!empty($tmpmember->error)) {
125 $this->errors[] = $tmpmember->error;
133 if (
$object->add_to_abo() < 0) {
134 $this->errors =
$object->errors;
136 $this->errors[] =
$object->error;
145 } elseif ($action ==
'MEMBER_RESILIATE' || $action ==
'MEMBER_DELETE') {
146 dol_syslog(
"Trigger '".$this->
name.
"' for action '$action' launched by ".__FILE__.
". id=".
$object->id);
150 if (
$object->del_to_abo() < 0) {
151 $this->errors =
$object->errors;
153 $this->errors[] =
$object->error;
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Class to manage members of a foundation.
Class to stock current configuration.
Class that all triggers must inherit.
Class of triggers for MailmanSpip module.
runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
Function called when a Dolibarr business event is done.
__construct($db)
Constructor.
Class to manage translations.
Class to manage Dolibarr users.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after 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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
$conf db name
Only used if Module[ID]Name translation string is not found.