Merge pull request #1753 from marcosgdf/triggers-refactor

Refactored Dolibarr triggers
This commit is contained in:
Laurent Destailleur 2014-07-20 04:52:27 +02:00
commit f46db55f71
11 changed files with 654 additions and 1509 deletions

View File

@ -23,6 +23,7 @@
* \brief Fichier de la classe de gestion des triggers
*/
require_once DOL_DOCUMENT_ROOT.'/core/triggers/DolibarrTriggers.class.php';
/**
* Class to manage triggers

View File

@ -0,0 +1,149 @@
<?php
/*
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* Class that all the triggers must extend
*/
abstract class DolibarrTriggers
{
/**
* Database handler
* @var DoliDB
*/
protected $db;
/**
* Name of the trigger
* @var mixed|string
*/
public $name = '';
/**
* Description of the trigger
* @var string
*/
public $description = '';
/**
* Version of the trigger
* @var string
*/
public $version = self::VERSION_DEVELOPMENT;
/**
* Image of the trigger
* @var string
*/
public $picto = 'technic';
/**
* Category of the trigger
* @var string
*/
public $family = '';
/**
* Error reported by the trigger
* @var string
* @deprecated Use $this->errors
*/
public $error = '';
/**
* Errors reported by the trigger
* @var array
*/
public $errors = array();
const VERSION_DEVELOPMENT = 'development';
const VERSION_EXPERIMENTAL = 'experimental';
const VERSION_DOLIBARR = 'dolibarr';
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
public function __construct(DoliDB $db) {
$this->db = $db;
if (!isset($this->name)) {
$this->name = preg_replace('/^Interface/i', '', get_class($this));
}
}
/**
* Returns the name of the trigger file
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Returns the description of trigger file
*
* @return string
*/
public function getDesc()
{
return $this->description;
}
/**
* Returns the version of the trigger file
*
* @return string Version of trigger file
*/
public function getVersion()
{
global $langs;
$langs->load("admin");
if ($this->version == self::VERSION_DEVELOPMENT) {
return $langs->trans("Development");
} elseif ($this->version == self::VERSION_EXPERIMENTAL) {
return $langs->trans("Experimental");
} elseif ($this->version == self::VERSION_DOLIBARR) {
return DOL_VERSION;
} elseif ($this->version) {
return $this->version;
} else {
return $langs->trans("Unknown");
}
}
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
abstract function run_trigger($action, $object, User $user, Translate $langs, Conf $conf);
}

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -26,81 +27,25 @@
/**
* Class of triggers for security events
*/
class InterfaceLogevents
class InterfaceLogevents extends DolibarrTriggers
{
var $db;
var $error;
public $picto = 'technic';
public $family = 'core';
public $description = "Triggers of this module allows to add security event records inside Dolibarr.";
public $version = self::VERSION_DOLIBARR;
var $date;
var $duree;
var $texte;
var $desc;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
$this->name = preg_replace('/^Interface/i','',get_class($this));
$this->family = "core";
$this->description = "Triggers of this module allows to add security event records inside Dolibarr.";
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
$this->picto = 'technic';
}
/**
* Return name of trigger file
*
* @return string Name of trigger file
*/
function getName()
{
return $this->name;
}
/**
* Return description of trigger file
*
* @return string Description of trigger file
*/
function getDesc()
{
return $this->description;
}
/**
* Return version of trigger file
*
* @return string Version of trigger file
*/
function getVersion()
{
global $langs;
$langs->load("admin");
if ($this->version == 'experimental') return $langs->trans("Experimental");
elseif ($this->version == 'dolibarr') return DOL_VERSION;
elseif ($this->version) return $this->version;
else return $langs->trans("Unknown");
}
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @param string $entity Value for instance of data (Always 1 except if module MultiCompany is installed)
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
function run_trigger($action,$object,$user,$langs,$conf,$entity=1)
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
{
if (! empty($conf->global->MAIN_LOGEVENTS_DISABLE_ALL)) return 0; // Log events is disabled (hidden features)
@ -110,8 +55,7 @@ class InterfaceLogevents
if (empty($conf->entity)) $conf->entity = $entity; // forcing of the entity if it's not defined (ex: in login form)
$this->date=dol_now();
$this->duree=0;
$date = dol_now();
// Actions
if ($action == 'USER_LOGIN')
@ -119,24 +63,24 @@ class InterfaceLogevents
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
// Initialisation donnees (date,duree,texte,desc)
$this->texte="(UserLogged,".$object->login.")";
$this->desc="(UserLogged,".$object->login.")";
$text="(UserLogged,".$object->login.")";
$desc="(UserLogged,".$object->login.")";
}
if ($action == 'USER_LOGIN_FAILED')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
// Initialisation donnees (date,duree,texte,desc)
$this->texte=$object->trigger_mesg; // Message direct
$this->desc=$object->trigger_mesg; // Message direct
$text=$object->trigger_mesg; // Message direct
$desc=$object->trigger_mesg; // Message direct
}
if ($action == 'USER_LOGOUT')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
// Initialisation donnees (date,duree,texte,desc)
$this->texte="(UserLogoff,".$object->login.")";
$this->desc="(UserLogoff,".$object->login.")";
$text="(UserLogoff,".$object->login.")";
$desc="(UserLogoff,".$object->login.")";
}
if ($action == 'USER_CREATE')
{
@ -144,8 +88,8 @@ class InterfaceLogevents
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$this->texte=$langs->transnoentities("NewUserCreated",$object->login);
$this->desc=$langs->transnoentities("NewUserCreated",$object->login);
$text=$langs->transnoentities("NewUserCreated",$object->login);
$desc=$langs->transnoentities("NewUserCreated",$object->login);
}
elseif ($action == 'USER_MODIFY')
{
@ -153,8 +97,8 @@ class InterfaceLogevents
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$this->texte=$langs->transnoentities("EventUserModified",$object->login);
$this->desc=$langs->transnoentities("EventUserModified",$object->login);
$text=$langs->transnoentities("EventUserModified",$object->login);
$desc=$langs->transnoentities("EventUserModified",$object->login);
}
elseif ($action == 'USER_NEW_PASSWORD')
{
@ -162,8 +106,8 @@ class InterfaceLogevents
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$this->texte=$langs->transnoentities("NewUserPassword",$object->login);
$this->desc=$langs->transnoentities("NewUserPassword",$object->login);
$text=$langs->transnoentities("NewUserPassword",$object->login);
$desc=$langs->transnoentities("NewUserPassword",$object->login);
}
elseif ($action == 'USER_ENABLEDISABLE')
{
@ -172,13 +116,13 @@ class InterfaceLogevents
// Initialisation donnees (date,duree,texte,desc)
if ($object->statut == 0)
{
$this->texte=$langs->transnoentities("UserEnabled",$object->login);
$this->desc=$langs->transnoentities("UserEnabled",$object->login);
$text=$langs->transnoentities("UserEnabled",$object->login);
$desc=$langs->transnoentities("UserEnabled",$object->login);
}
if ($object->statut == 1)
{
$this->texte=$langs->transnoentities("UserDisabled",$object->login);
$this->desc=$langs->transnoentities("UserDisabled",$object->login);
$text=$langs->transnoentities("UserDisabled",$object->login);
$desc=$langs->transnoentities("UserDisabled",$object->login);
}
}
elseif ($action == 'USER_DELETE')
@ -186,8 +130,8 @@ class InterfaceLogevents
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$this->texte=$langs->transnoentities("UserDeleted",$object->login);
$this->desc=$langs->transnoentities("UserDeleted",$object->login);
$text=$langs->transnoentities("UserDeleted",$object->login);
$desc=$langs->transnoentities("UserDeleted",$object->login);
}
// Groupes
@ -196,24 +140,24 @@ class InterfaceLogevents
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$this->texte=$langs->transnoentities("NewGroupCreated",$object->nom);
$this->desc=$langs->transnoentities("NewGroupCreated",$object->nom);
$text=$langs->transnoentities("NewGroupCreated",$object->nom);
$desc=$langs->transnoentities("NewGroupCreated",$object->nom);
}
elseif ($action == 'GROUP_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$this->texte=$langs->transnoentities("GroupModified",$object->nom);
$this->desc=$langs->transnoentities("GroupModified",$object->nom);
$text=$langs->transnoentities("GroupModified",$object->nom);
$desc=$langs->transnoentities("GroupModified",$object->nom);
}
elseif ($action == 'GROUP_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("users");
// Initialisation donnees (date,duree,texte,desc)
$this->texte=$langs->transnoentities("GroupDeleted",$object->nom);
$this->desc=$langs->transnoentities("GroupDeleted",$object->nom);
$text=$langs->transnoentities("GroupDeleted",$object->nom);
$desc=$langs->transnoentities("GroupDeleted",$object->nom);
}
// If not found
@ -226,30 +170,27 @@ class InterfaceLogevents
*/
// Add entry in event table
if ($this->date)
include_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
$event=new Events($this->db);
$event->type=$action;
$event->dateevent=$date;
$event->label=$text;
$event->description=$desc;
$event->user_agent=$_SERVER["HTTP_USER_AGENT"];
$result=$event->create($user);
if ($result > 0)
{
include_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php';
return 1;
}
else
{
$error ="Failed to insert security event: ".$event->error;
$this->error=$error;
$event=new Events($this->db);
$event->type=$action;
$event->dateevent=$this->date;
$event->label=$this->texte;
$event->description=$this->desc;
$event->user_agent=$_SERVER["HTTP_USER_AGENT"];
$result=$event->create($user);
if ($result > 0)
{
return 1;
}
else
{
$error ="Failed to insert security event: ".$event->error;
$this->error=$error;
dol_syslog(get_class($this).": ".$this->error, LOG_ERR);
return -1;
}
dol_syslog(get_class($this).": ".$this->error, LOG_ERR);
return -1;
}
return 0;

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2011-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -25,76 +26,25 @@
/**
* Class of triggers for paypal module
*/
class InterfacePaypalWorkflow
class InterfacePaypalWorkflow extends DolibarrTriggers
{
var $db;
public $picto = 'paypal@paypal';
public $family = 'paypal';
public $description = "Triggers of this module allows to manage paypal workflow";
public $version = self::VERSION_DOLIBARR;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
$this->name = preg_replace('/^Interface/i','',get_class($this));
$this->family = "paypal";
$this->description = "Triggers of this module allows to manage paypal workflow";
$this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version
$this->picto = 'paypal@paypal';
}
/**
* Renvoi nom du lot de triggers
*
* @return string Nom du lot de triggers
*/
function getName()
{
return $this->name;
}
/**
* Renvoi descriptif du lot de triggers
*
* @return string Descriptif du lot de triggers
*/
function getDesc()
{
return $this->description;
}
/**
* Renvoi version du lot de triggers
*
* @return string Version du lot de triggers
*/
function getVersion()
{
global $langs;
$langs->load("admin");
if ($this->version == 'development') return $langs->trans("Development");
elseif ($this->version == 'experimental') return $langs->trans("Experimental");
elseif ($this->version == 'dolibarr') return DOL_VERSION;
elseif ($this->version) return $this->version;
else return $langs->trans("Unknown");
}
/**
* Fonction appelee lors du declenchement d'un evenement Dolibarr.
* D'autres fonctions run_trigger peuvent etre presentes dans core/triggers
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
function run_trigger($action,$object,$user,$langs,$conf)
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
{
// Mettre ici le code a executer en reaction de l'action
// Les donnees de l'action sont stockees dans $object

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -27,76 +28,25 @@
* Class of triggers for workflow module
*/
class InterfaceWorkflowManager
class InterfaceWorkflowManager extends DolibarrTriggers
{
var $db;
public $picto = 'paypal@paypal';
public $family = 'core';
public $description = "Triggers of this module allows to manage workflows";
public $version = self::VERSION_DOLIBARR;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
$this->name = preg_replace('/^Interface/i','',get_class($this));
$this->family = "core";
$this->description = "Triggers of this module allows to manage workflows";
$this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version
$this->picto = 'technic';
}
/**
* Return name of trigger file
*
* @return string Name of trigger file
*/
function getName()
{
return $this->name;
}
/**
* Return description of trigger file
*
* @return string Description of trigger file
*/
function getDesc()
{
return $this->description;
}
/**
* Return version of trigger file
*
* @return string Version of trigger file
*/
function getVersion()
{
global $langs;
$langs->load("admin");
if ($this->version == 'development') return $langs->trans("Development");
elseif ($this->version == 'experimental') return $langs->trans("Experimental");
elseif ($this->version == 'dolibarr') return DOL_VERSION;
elseif ($this->version) return $this->version;
else return $langs->trans("Unknown");
}
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
function run_trigger($action,$object,$user,$langs,$conf)
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
{
if (empty($conf->workflow->enabled)) return 0; // Module not active, we do nothing

View File

@ -3,6 +3,7 @@
* Copyright (C) 2009-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cedric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -28,123 +29,67 @@
/**
* Class of triggered functions for agenda module
*/
class InterfaceActionsAuto
class InterfaceActionsAuto extends DolibarrTriggers
{
var $db;
var $error;
public $family = 'agenda';
public $description = "Triggers of this module add actions in agenda according to setup made in agenda setup.";
public $version = self::VERSION_DOLIBARR;
public $picto = 'action';
var $date;
var $duree;
var $texte;
var $desc;
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
*
* Following properties must be filled:
* $object->actiontypecode (translation action code: AC_OTH, ...)
* $object->actionmsg (note, long text)
* $object->actionmsg2 (label, short text)
* $object->sendtoid (id of contact)
* $object->socid
* Optionnal:
* $object->fk_element
* $object->elementtype
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
{
// Module not active, we do nothing
if (empty($conf->agenda->enabled)) {
return 0;
}
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
$key = 'MAIN_AGENDA_ACTIONAUTO_'.$action;
$this->name = preg_replace('/^Interface/i','',get_class($this));
$this->family = "agenda";
$this->description = "Triggers of this module add actions in agenda according to setup made in agenda setup.";
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
$this->picto = 'action';
}
// Do not log events not enabled for this action
if (empty($conf->global->$key)) {
return 0;
}
/**
* Return name of trigger file
*
* @return string Name of trigger file
*/
function getName()
{
return $this->name;
}
/**
* Return description of trigger file
*
* @return string Description of trigger file
*/
function getDesc()
{
return $this->description;
}
/**
* Return version of trigger file
*
* @return string Version of trigger file
*/
function getVersion()
{
global $langs;
$langs->load("admin");
if ($this->version == 'experimental') return $langs->trans("Experimental");
elseif ($this->version == 'dolibarr') return DOL_VERSION;
elseif ($this->version) return $this->version;
else return $langs->trans("Unknown");
}
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
*
* Following properties must be filled:
* $object->actiontypecode (translation action code: AC_OTH, ...)
* $object->actionmsg (note, long text)
* $object->actionmsg2 (label, short text)
* $object->sendtoid (id of contact)
* $object->socid
* Optionnal:
* $object->fk_element
* $object->elementtype
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
function run_trigger($action,$object,$user,$langs,$conf)
{
$key='MAIN_AGENDA_ACTIONAUTO_'.$action;
//dol_syslog("xxxxxxxxxxx".$key);
if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing
if (empty($conf->global->$key)) return 0; // Do not log events not enabled for this action
$ok=0;
$langs->load("agenda");
// Actions
if ($action == 'COMPANY_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("NewCompanyToDolibarr",$object->nom);
$object->actionmsg=$langs->transnoentities("NewCompanyToDolibarr",$object->nom);
if (! empty($object->prefix)) $object->actionmsg.=" (".$object->prefix.")";
//$this->desc.="\n".$langs->transnoentities("Customer").': '.yn($object->client);
//$this->desc.="\n".$langs->transnoentities("Supplier").': '.yn($object->fournisseur);
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$object->socid=$object->id;
$ok=1;
}
elseif ($action == 'COMPANY_SENTBYMAIL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("orders");
$langs->load("agenda");
if (empty($object->actiontypecode)) $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) dol_syslog('Trigger called with property actionmsg2 on object not defined', LOG_ERR);
@ -152,14 +97,11 @@ class InterfaceActionsAuto
// Parameters $object->sendtoid defined by caller
//$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'CONTRACT_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("contracts");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractValidatedInDolibarr",$object->ref);
@ -167,13 +109,10 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'PROPAL_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("propal");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",$object->ref);
@ -181,13 +120,10 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'PROPAL_SENTBYMAIL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("propal");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail",$object->ref);
@ -199,13 +135,10 @@ class InterfaceActionsAuto
// Parameters $object->sendtoid defined by caller
//$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'PROPAL_CLOSE_SIGNED')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("propal");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref);
@ -213,13 +146,10 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'PROPAL_CLOSE_REFUSED')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("propal");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref);
@ -227,13 +157,10 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'ORDER_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("orders");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref);
@ -241,13 +168,10 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'ORDER_SENTBYMAIL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("orders");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderSentByEMail",$object->ref);
@ -259,14 +183,11 @@ class InterfaceActionsAuto
// Parameters $object->sendtoid defined by caller
//$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'BILL_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("bills");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref);
@ -274,14 +195,11 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'BILL_UNVALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("bills");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref);
@ -289,14 +207,11 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'BILL_SENTBYMAIL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("bills");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceSentByEMail",$object->ref);
@ -308,14 +223,11 @@ class InterfaceActionsAuto
// Parameters $object->sendtoid defined by caller
//$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'BILL_PAYED')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("bills");
$langs->load("agenda");
// Values for this action can't be defined by caller.
$object->actiontypecode='AC_OTH_AUTO';
@ -324,14 +236,11 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'BILL_CANCEL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("bills");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref);
@ -339,14 +248,11 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'FICHINTER_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("interventions");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionValidatedInDolibarr",$object->ref);
@ -356,14 +262,11 @@ class InterfaceActionsAuto
$object->sendtoid=0;
$object->fk_element=0;
$object->elementtype='';
$ok=1;
}
elseif ($action == 'FICHINTER_SENTBYMAIL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("interventions");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionSentByEMail",$object->ref);
@ -372,14 +275,11 @@ class InterfaceActionsAuto
// Parameters $object->sendtoid defined by caller
//$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'FICHINTER_CLASSIFY_BILLED')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("interventions");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedBilled",$object->ref);
@ -387,14 +287,11 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'SHIPPING_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("sendings");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingValidated",$object->ref);
@ -406,14 +303,11 @@ class InterfaceActionsAuto
// Parameters $object->sendtoid defined by caller
//$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'SHIPPING_SENTBYMAIL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("sendings");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingSentByEMail",$object->ref);
@ -425,13 +319,10 @@ class InterfaceActionsAuto
// Parameters $object->sendtoid defined by caller
//$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'ORDER_SUPPLIER_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("orders");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref);
@ -439,13 +330,10 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'ORDER_SUPPLIER_APPROVE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("orders");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderApprovedInDolibarr",$object->ref);
@ -453,13 +341,10 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'ORDER_SUPPLIER_REFUSE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("orders");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderRefusedInDolibarr",$object->ref);
@ -467,14 +352,11 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("bills");
$langs->load("agenda");
$langs->load("orders");
$object->actiontypecode='AC_OTH_AUTO';
@ -487,14 +369,11 @@ class InterfaceActionsAuto
// Parameters $object->sendtoid defined by caller
//$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'BILL_SUPPLIER_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("bills");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref);
@ -502,14 +381,11 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("bills");
$langs->load("agenda");
$langs->load("orders");
$object->actiontypecode='AC_OTH_AUTO';
@ -522,14 +398,11 @@ class InterfaceActionsAuto
// Parameters $object->sendtoid defined by caller
//$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'BILL_SUPPLIER_PAYED')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("bills");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref);
@ -537,14 +410,11 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'BILL_SUPPLIER_CANCELED')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("bills");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref);
@ -552,16 +422,13 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
// Members
elseif ($action == 'MEMBER_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("members");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberValidatedInDolibarr",$object->ref);
@ -571,14 +438,11 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'MEMBER_SUBSCRIPTION')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("members");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref);
@ -590,18 +454,11 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'MEMBER_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'MEMBER_RESILIATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("members");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberResiliatedInDolibarr",$object->ref);
@ -611,14 +468,11 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif ($action == 'MEMBER_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("members");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberDeletedInDolibarr",$object->ref);
@ -628,16 +482,13 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
// Projects
elseif ($action == 'PROJECT_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("projects");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref);
@ -646,15 +497,12 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
// Project tasks
elseif($action == 'TASK_CREATE') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("projects");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
@ -664,14 +512,11 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif($action == 'TASK_MODIFY') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("projects");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskModifiedInDolibarr",$object->ref);
@ -680,14 +525,11 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
elseif($action == 'TASK_DELETE') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$langs->load("projects");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskDeletedInDolibarr",$object->ref);
@ -696,7 +538,6 @@ class InterfaceActionsAuto
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0;
$ok=1;
}
// The trigger was enabled but we are missing the implementation, let the log know
@ -706,63 +547,62 @@ class InterfaceActionsAuto
return 0;
}
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
// Add entry in event table
if ($ok)
{
$now=dol_now();
$now=dol_now();
if(isset($_SESSION['listofnames']))
if(isset($_SESSION['listofnames']))
{
$attachs=$_SESSION['listofnames'];
if($attachs && strpos($action,'SENTBYMAIL'))
{
$attachs=$_SESSION['listofnames'];
if($attachs && strpos($action,'SENTBYMAIL'))
{
$object->actionmsg.="\n".$langs->transnoentities("AttachedFiles").': '.$attachs;
}
$object->actionmsg.="\n".$langs->transnoentities("AttachedFiles").': '.$attachs;
}
}
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
$contactforaction=new Contact($this->db);
$societeforaction=new Societe($this->db);
if ($object->sendtoid > 0) $contactforaction->fetch($object->sendtoid);
if ($object->socid > 0) $societeforaction->fetch($object->socid);
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
$contactforaction=new Contact($this->db);
$societeforaction=new Societe($this->db);
if ($object->sendtoid > 0) $contactforaction->fetch($object->sendtoid);
if ($object->socid > 0) $societeforaction->fetch($object->socid);
// Insertion action
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$actioncomm = new ActionComm($this->db);
$actioncomm->type_code = $object->actiontypecode; // code of parent table llx_c_actioncomm (will be deprecated)
$actioncomm->code='AC_'.$action;
$actioncomm->label = $object->actionmsg2;
$actioncomm->note = $object->actionmsg;
$actioncomm->datep = $now;
$actioncomm->datef = $now;
$actioncomm->durationp = 0;
$actioncomm->punctual = 1;
$actioncomm->percentage = -1; // Not applicable
$actioncomm->contact = $contactforaction;
$actioncomm->societe = $societeforaction;
$actioncomm->author = $user; // User saving action
$actioncomm->usertodo = $user; // User owner of action
//$actioncomm->userdone = $user; // User doing action
// Insertion action
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
$actioncomm = new ActionComm($this->db);
$actioncomm->type_code = $object->actiontypecode; // code of parent table llx_c_actioncomm (will be deprecated)
$actioncomm->code='AC_'.$action;
$actioncomm->label = $object->actionmsg2;
$actioncomm->note = $object->actionmsg;
$actioncomm->datep = $now;
$actioncomm->datef = $now;
$actioncomm->durationp = 0;
$actioncomm->punctual = 1;
$actioncomm->percentage = -1; // Not applicable
$actioncomm->contact = $contactforaction;
$actioncomm->societe = $societeforaction;
$actioncomm->author = $user; // User saving action
$actioncomm->usertodo = $user; // User owner of action
//$actioncomm->userdone = $user; // User doing action
$actioncomm->fk_element = $object->id;
$actioncomm->elementtype = $object->element;
$actioncomm->fk_element = $object->id;
$actioncomm->elementtype = $object->element;
$ret=$actioncomm->add($user); // User qui saisit l'action
if ($ret > 0)
{
$_SESSION['LAST_ACTION_CREATED'] = $ret;
return 1;
}
else
{
$error ="Failed to insert event : ".$actioncomm->error." ".join(',',$actioncomm->errors);
$this->error=$error;
$this->errors=$actioncomm->errors;
$ret=$actioncomm->add($user); // User qui saisit l'action
if ($ret > 0)
{
$_SESSION['LAST_ACTION_CREATED'] = $ret;
return 1;
}
else
{
$error ="Failed to insert event : ".$actioncomm->error." ".join(',',$actioncomm->errors);
$this->error=$error;
$this->errors=$actioncomm->errors;
dol_syslog("interface_modAgenda_ActionsAuto.class.php: ".$this->error, LOG_ERR);
return -1;
}
dol_syslog("interface_modAgenda_ActionsAuto.class.php: ".$this->error, LOG_ERR);
return -1;
}
return 0;

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -27,76 +28,25 @@ require_once (DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php");
/**
* Class of triggers for ldap module
*/
class InterfaceLdapsynchro
class InterfaceLdapsynchro extends DolibarrTriggers
{
var $db;
var $error;
public $family = 'ldap';
public $description = "Triggers of this module allows to synchronize Dolibarr toward a LDAP database.";
public $version = self::VERSION_DOLIBARR;
public $picto = 'technic';
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
$this->name = preg_replace('/^Interface/i','',get_class($this));
$this->family = "ldap";
$this->description = "Triggers of this module allows to synchronize Dolibarr toward a LDAP database.";
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
$this->picto = 'technic';
}
/**
* Return name of trigger file
*
* @return string Name of trigger file
*/
function getName()
{
return $this->name;
}
/**
* Return description of trigger file
*
* @return string Description of trigger file
*/
function getDesc()
{
return $this->description;
}
/**
* Return version of trigger file
*
* @return string Version of trigger file
*/
function getVersion()
{
global $langs;
$langs->load("admin");
if ($this->version == 'experimental') return $langs->trans("Experimental");
elseif ($this->version == 'dolibarr') return DOL_VERSION;
elseif ($this->version) return $this->version;
else return $langs->trans("Unknown");
}
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
function run_trigger($action,$object,$user,$langs,$conf)
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
{
if (empty($conf->ldap->enabled)) return 0; // Module not active, we do nothing

View File

@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -27,77 +28,26 @@ require_once (DOL_DOCUMENT_ROOT."/user/class/usergroup.class.php");
/**
* Class of triggers for MailmanSpip module
*/
class InterfaceMailmanSpipsynchro
class InterfaceMailmanSpipsynchro extends DolibarrTriggers
{
var $db;
var $error;
public $family = 'ldap';
public $description = "Triggers of this module allows to synchronize Mailman an Spip.";
public $version = self::VERSION_DOLIBARR;
public $picto = 'technic';
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
$this->name = preg_replace('/^Interface/i','',get_class($this));
$this->family = "ldap";
$this->description = "Triggers of this module allows to synchronize Mailman an Spip.";
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
$this->picto = 'technic';
}
/**
* Return name of trigger file
*
* @return string Name of trigger file
*/
function getName()
{
return $this->name;
}
/**
* Return description of trigger file
*
* @return string Description of trigger file
*/
function getDesc()
{
return $this->description;
}
/**
* Return version of trigger file
*
* @return string Version of trigger file
*/
function getVersion()
{
global $langs;
$langs->load("admin");
if ($this->version == 'experimental') return $langs->trans("Experimental");
elseif ($this->version == 'dolibarr') return DOL_VERSION;
elseif ($this->version) return $this->version;
else return $langs->trans("Unknown");
}
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
function run_trigger($action,$object,$user,$langs,$conf)
{
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
{
if (empty($conf->mailmanspip->enabled)) return 0; // Module not active, we do nothing
if (! function_exists('ldap_connect'))
@ -106,38 +56,7 @@ class InterfaceMailmanSpipsynchro
return 0;
}
// Users
if ($action == 'USER_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_NEW_PASSWORD')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_ENABLEDISABLE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_SETINGROUP')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_REMOVEFROMGROUP')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'CATEGORY_LINK')
if ($action == 'CATEGORY_LINK')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
@ -211,10 +130,6 @@ class InterfaceMailmanSpipsynchro
return $return;
}
elseif ($action == 'MEMBER_NEW_PASSWORD')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'MEMBER_RESILIATE' || $action == 'MEMBER_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
@ -231,16 +146,10 @@ class InterfaceMailmanSpipsynchro
{
$return=1;
}
return $return;
}
// If not found
/*
else
{
dol_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action.");
return -1;
}
*/
return 0;
}

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013-2014 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -27,9 +27,13 @@
/**
* Class of triggers for notification module
*/
class InterfaceNotification
class InterfaceNotification extends DolibarrTriggers
{
var $db;
public $family = 'notification';
public $description = "Triggers of this module send email notifications according to Notification module setup.";
public $version = self::VERSION_DOLIBARR;
public $picto = 'email';
var $listofmanagedevents=array(
'BILL_VALIDATE',
'ORDER_VALIDATE',
@ -40,187 +44,87 @@ class InterfaceNotification
'SHIPPING_VALIDATE'
);
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
$this->name = preg_replace('/^Interface/i','',get_class($this));
$this->family = "notification";
$this->description = "Triggers of this module send email notifications according to Notification module setup.";
$this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version
$this->picto = 'email';
}
/**
* Return name of trigger file
*
* @return string Name of trigger file
*/
function getName()
{
return $this->name;
}
/**
* Return description of trigger file
*
* @return string Description of trigger file
*/
function getDesc()
{
return $this->description;
}
/**
* Return version of trigger file
*
* @return string Version of trigger file
*/
function getVersion()
{
global $langs;
$langs->load("admin");
if ($this->version == 'experimental') return $langs->trans("Experimental");
elseif ($this->version == 'dolibarr') return DOL_VERSION;
elseif ($this->version) return $this->version;
else return $langs->trans("Unknown");
}
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
function run_trigger($action,$object,$user,$langs,$conf)
{
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
{
if (empty($conf->notification->enabled)) return 0; // Module not active, we do nothing
require_once DOL_DOCUMENT_ROOT .'/core/class/notify.class.php';
if ($action == 'BILL_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other");
$ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
if (! file_exists($filepdf)) $filepdf='';
$filepdf=''; // We can't add PDF as it is not generated yet.
$langs->load("other");
$mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated",$object->ref);
switch ($action) {
case 'BILL_VALIDATE':
$dir_output = $conf->facture->dir_output;
$object_type = 'facture';
$mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated",$object->ref);
break;
case 'ORDER_VALIDATE':
$dir_output = $conf->commande->dir_output;
$object_type = 'order';
$mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$object->ref);
break;
case 'PROPAL_VALIDATE':
$dir_output = $conf->propal->dir_output;
$object_type = 'propal';
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$object->ref);
break;
case 'FICHINTER_VALIDATE':
$dir_output = $conf->facture->dir_output;
$object_type = 'ficheinter';
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref);
break;
case 'ORDER_SUPPLIER_APPROVE':
$dir_output = $conf->fournisseur->dir_output.'/commande/';
$object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$object->ref,$user->getFullName($langs));
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
break;
case 'ORDER_SUPPLIER_REFUSE':
$dir_output = $conf->fournisseur->dir_output.'/commande/';
$object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$object->ref,$user->getFullName($langs));
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
break;
case 'SHIPPING_VALIDATE':
$dir_output = $conf->expedition->dir_output.'/sending/';
$object_type = 'order_supplier';
$mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$object->ref);
break;
default:
return 0;
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, 'facture', $object->id, $filepdf);
}
elseif ($action == 'ORDER_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);
$ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
if (! file_exists($filepdf)) $filepdf='';
$filepdf=''; // We can't add PDF as it is not generated yet.
$langs->load("other");
$mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated",$object->ref);
$ref = dol_sanitizeFileName($object->ref);
$pdf_path = "$dir_output/$ref/$ref.pdf";
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, 'order', $object->id, $filepdf);
if (!file_exists($pdf_path)) {
// We can't add PDF as it is not generated yet.
$filepdf = '';
} else {
$filepdf = $pdf_path;
}
elseif ($action == 'PROPAL_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, $object_type, $object->id, $filepdf);
$ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->propal->dir_output . '/' . $ref . '/' . $ref . '.pdf';
if (! file_exists($filepdf)) $filepdf='';
$filepdf=''; // We can't add PDF as it is not generated yet.
$langs->load("other");
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated",$object->ref);
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, 'propal', $object->id, $filepdf);
}
elseif ($action == 'FICHINTER_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
if (! file_exists($filepdf)) $filepdf='';
$filepdf=''; // We can't add PDF as it is not generated yet.
$langs->load("other");
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated",$object->ref);
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, 'ficheinter', $object->id, $filepdf);
}
elseif ($action == 'ORDER_SUPPLIER_APPROVE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->fournisseur->dir_output . '/commande/' . $ref . '/' . $ref . '.pdf';
if (! file_exists($filepdf)) $filepdf='';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy",$object->ref,$user->getFullName($langs));
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf);
}
elseif ($action == 'ORDER_SUPPLIER_REFUSE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->fournisseur->dir_output . '/commande/' . $ref . '/' . $ref . '.pdf';
if (! file_exists($filepdf)) $filepdf='';
$mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
$mesg.= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy",$object->ref,$user->getFullName($langs));
$mesg.= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf);
}
elseif ($action == 'SHIPPING_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->expedition->dir_output . '/sending/' . $ref . '/' . $ref . '.pdf';
if (! file_exists($filepdf)) $filepdf='';
$mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated",$object->ref);
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, 'expedition', $object->id, $filepdf);
}
// If not found
/*
else
{
dol_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action.");
return -1;
}
*/
return 0;
return 1;
}
@ -231,7 +135,7 @@ class InterfaceNotification
*/
function getListOfManagedEvents()
{
global $conf,$langs;
global $conf;
$ret=array();

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2005-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -32,674 +33,224 @@
/**
* Class of triggers for demo module
*/
class InterfaceDemo
class InterfaceDemo extends DolibarrTriggers
{
var $db;
/**
* Constructor
*
* @param DoliDB $db Database handler
*/
function __construct($db)
{
$this->db = $db;
$this->name = preg_replace('/^Interface/i','',get_class($this));
$this->family = "demo";
$this->description = "Triggers of this module are empty functions. They have no effect. They are provided for tutorial purpose only.";
$this->version = 'dolibarr'; // 'development', 'experimental', 'dolibarr' or version
$this->picto = 'technic';
}
/**
* Return name of trigger file
*
* @return string Name of trigger file
*/
function getName()
{
return $this->name;
}
/**
* Return description of trigger file
*
* @return string Description of trigger file
*/
function getDesc()
{
return $this->description;
}
/**
* Return version of trigger file
*
* @return string Version of trigger file
*/
function getVersion()
{
global $langs;
$langs->load("admin");
public $family = 'demo';
public $picto = 'technic';
public $description = "Triggers of this module are empty functions. They have no effect. They are provided for tutorial purpose only.";
public $version = self::VERSION_DOLIBARR;
if ($this->version == 'development') return $langs->trans("Development");
elseif ($this->version == 'experimental') return $langs->trans("Experimental");
elseif ($this->version == 'dolibarr') return DOL_VERSION;
elseif ($this->version) return $this->version;
else return $langs->trans("Unknown");
}
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
function run_trigger($action,$object,$user,$langs,$conf)
public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
{
// Put here code you want to execute when a Dolibarr business events occurs.
// Put here code you want to execute when a Dolibarr business events occurs.
// Data and type of action are stored into $object and $action
// Users
if ($action == 'USER_LOGIN')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_UPDATE_SESSION')
{
// Warning: To increase performances, this action is triggered only if
// constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1.
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_CREATE')
{
$object->error=$action;
return -1;
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_CREATE_FROM_CONTACT')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_NEW_PASSWORD')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_ENABLEDISABLE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_LOGOUT')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_SETINGROUP')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_REMOVEFROMGROUP')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
switch ($action) {
// Users
case 'USER_LOGIN':
case 'USER_UPDATE_SESSION':
case 'USER_CREATE':
case 'USER_CREATE_FROM_CONTACT':
case 'USER_LOGIN':
// Warning: To increase performances, this action is triggered only if
// constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1.
case 'USER_UPDATE_SESSION':
case 'USER_CREATE':
case 'USER_CREATE_FROM_CONTACT':
case 'USER_MODIFY':
case 'USER_NEW_PASSWORD':
case 'USER_ENABLEDISABLE':
case 'USER_DELETE':
case 'USER_LOGOUT':
case 'USER_SETINGROUP':
case 'USER_REMOVEFROMGROUP':
// Actions
case 'ACTION_MODIFY':
case 'ACTION_CREATE':
case 'ACTION_DELETE':
// Action
elseif ($action == 'ACTION_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ACTION_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ACTION_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Groups
elseif ($action == 'GROUP_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'GROUP_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'GROUP_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Companies
elseif ($action == 'COMPANY_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'COMPANY_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'COMPANY_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Groups
case 'GROUP_CREATE':
case 'GROUP_MODIFY':
case 'GROUP_DELETE':
// Contacts
elseif ($action == 'CONTACT_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'CONTACT_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'CONTACT_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'CONTACT_ENABLEDISABLE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Companies
case 'COMPANY_CREATE':
case 'COMPANY_MODIFY':
case 'COMPANY_DELETE':
// Products
elseif ($action == 'PRODUCT_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PRODUCT_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PRODUCT_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PRODUCT_PRICE_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
//Stock mouvement
elseif ($action == 'STOCK_MOVEMENT')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
//MYECMDIR
elseif ($action == 'MYECMDIR_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'MYECMDIR_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'MYECMDIR_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Contacts
case 'CONTACT_CREATE':
case 'CONTACT_MODIFY':
case 'CONTACT_DELETE':
case 'CONTACT_ENABLEDISABLE':
// Customer orders
elseif ($action == 'ORDER_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_CLONE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_BUILDDOC')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_SENTBYMAIL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_CLASSIFY_BILLED')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEORDER_INSERT')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEORDER_UPDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEORDER_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Products
case 'PRODUCT_CREATE':
case 'PRODUCT_MODIFY':
case 'PRODUCT_DELETE':
case 'PRODUCT_PRICE_MODIFY':
// Supplier orders
elseif ($action == 'ORDER_SUPPLIER_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_SUPPLIER_CLONE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_SUPPLIER_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_SUPPLIER_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_SUPPLIER_APPROVE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_SUPPLIER_REFUSE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_SUPPLIER_CANCEL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'ORDER_SUPPLIER_BUILDDOC')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEORDER_SUPPLIER_DISPATCH')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEORDER_SUPPLIER_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEORDER_SUPPLIER_UPDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
//Stock mouvement
case 'STOCK_MOVEMENT':
// Proposals
elseif ($action == 'PROPAL_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PROPAL_CLONE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PROPAL_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PROPAL_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PROPAL_BUILDDOC')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PROPAL_SENTBYMAIL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PROPAL_CLOSE_SIGNED')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PROPAL_CLOSE_REFUSED')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PROPAL_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEPROPAL_INSERT')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEPROPAL_UPDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEPROPAL_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
//MYECMDIR
case 'MYECMDIR_DELETE':
case 'MYECMDIR_CREATE':
case 'MYECMDIR_MODIFY':
// Contracts
elseif ($action == 'CONTRACT_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'CONTRACT_ACTIVATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'CONTRACT_CANCEL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'CONTRACT_CLOSE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'CONTRACT_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINECONTRACT_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINECONTRACT_UPDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINECONTRACT_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Customer orders
case 'ORDER_CREATE':
case 'ORDER_CLONE':
case 'ORDER_VALIDATE':
case 'ORDER_DELETE':
case 'ORDER_BUILDDOC':
case 'ORDER_SENTBYMAIL':
case 'ORDER_CLASSIFY_BILLED':
case 'LINEORDER_INSERT':
case 'LINEORDER_UPDATE':
case 'LINEORDER_DELETE':
// Bills
elseif ($action == 'BILL_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_CLONE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_UNVALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_BUILDDOC')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_SENTBYMAIL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_CANCEL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_PAYED')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEBILL_INSERT')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEBILL_UPDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEBILL_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Supplier orders
case 'ORDER_SUPPLIER_CREATE':
case 'ORDER_SUPPLIER_CLONE':
case 'ORDER_SUPPLIER_VALIDATE':
case 'ORDER_SUPPLIER_DELETE':
case 'ORDER_SUPPLIER_APPROVE':
case 'ORDER_SUPPLIER_REFUSE':
case 'ORDER_SUPPLIER_CANCEL':
case 'ORDER_SUPPLIER_SENTBYMAIL':
case 'ORDER_SUPPLIER_BUILDDOC':
case 'LINEORDER_SUPPLIER_DISPATCH':
case 'LINEORDER_SUPPLIER_CREATE':
case 'LINEORDER_SUPPLIER_UPDATE':
//Supplier Bill
elseif ($action == 'BILL_SUPPLIER_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_SUPPLIER_UPDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_SUPPLIER_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_SUPPLIER_PAYED')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_SUPPLIER_UNPAYED')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'BILL_SUPPLIER_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEBILL_SUPPLIER_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEBILL_SUPPLIER_UPDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEBILL_SUPPLIER_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Payments
elseif ($action == 'PAYMENT_CUSTOMER_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PAYMENT_SUPPLIER_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PAYMENT_ADD_TO_BANK')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PAYMENT_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
//Donation
elseif ($action == 'DON_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'DON_UPDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'DON_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Proposals
case 'PROPAL_CREATE':
case 'PROPAL_CLONE':
case 'PROPAL_MODIFY':
case 'PROPAL_VALIDATE':
case 'PROPAL_BUILDDOC':
case 'PROPAL_SENTBYMAIL':
case 'PROPAL_CLOSE_SIGNED':
case 'PROPAL_CLOSE_REFUSED':
case 'PROPAL_DELETE':
case 'LINEPROPAL_INSERT':
case 'LINEPROPAL_UPDATE':
case 'LINEPROPAL_DELETE':
// Interventions
elseif ($action == 'FICHINTER_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'FICHINTER_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'FICHINTER_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'FICHINTER_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEFICHINTER_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEFICHINTER_UPDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEFICHINTER_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Members
elseif ($action == 'MEMBER_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'MEMBER_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'MEMBER_SUBSCRIPTION')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'MEMBER_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'MEMBER_NEW_PASSWORD')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'MEMBER_RESILIATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'MEMBER_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Categories
elseif ($action == 'CATEGORY_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'CATEGORY_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'CATEGORY_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Projects
elseif ($action == 'PROJECT_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PROJECT_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PROJECT_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Project tasks
elseif ($action == 'TASK_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'TASK_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'TASK_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Task time spent
elseif ($action == 'TASK_TIMESPENT_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'TASK_TIMESPENT_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'TASK_TIMESPENT_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Shipping
elseif ($action == 'SHIPPING_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'SHIPPING_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'SHIPPING_VALIDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'SHIPPING_SENTBYMAIL')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'SHIPPING_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'SHIPPING_BUILDDOC')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Contracts
case 'CONTRACT_CREATE':
case 'CONTRACT_ACTIVATE':
case 'CONTRACT_CANCEL':
case 'CONTRACT_CLOSE':
case 'CONTRACT_DELETE':
case 'LINECONTRACT_CREATE':
case 'LINECONTRACT_UPDATE':
case 'LINECONTRACT_DELETE':
return 0;
}
// Bills
case 'BILL_CREATE':
case 'BILL_CLONE':
case 'BILL_MODIFY':
case 'BILL_VALIDATE':
case 'BILL_UNVALIDATE':
case 'BILL_BUILDDOC':
case 'BILL_SENTBYMAIL':
case 'BILL_CANCEL':
case 'BILL_DELETE':
case 'BILL_PAYED':
case 'LINEBILL_INSERT':
case 'LINEBILL_UPDATE':
case 'LINEBILL_DELETE':
}
?>
//Supplier Bill
case 'BILL_SUPPLIER_CREATE':
case 'BILL_SUPPLIER_UPDATE':
case 'BILL_SUPPLIER_DELETE':
case 'BILL_SUPPLIER_PAYED':
case 'BILL_SUPPLIER_UNPAYED':
case 'BILL_SUPPLIER_VALIDATE':
case 'LINEBILL_SUPPLIER_CREATE':
case 'LINEBILL_SUPPLIER_UPDATE':
case 'LINEBILL_SUPPLIER_DELETE':
// Payments
case 'PAYMENT_CUSTOMER_CREATE':
case 'PAYMENT_SUPPLIER_CREATE':
case 'PAYMENT_ADD_TO_BANK':
case 'PAYMENT_DELETE':
//Donation
case 'DON_CREATE':
case 'DON_UPDATE':
case 'DON_DELETE':
// Interventions
case 'FICHINTER_CREATE':
case 'FICHINTER_MODIFY':
case 'FICHINTER_VALIDATE':
case 'FICHINTER_DELETE':
case 'LINEFICHINTER_CREATE':
case 'LINEFICHINTER_UPDATE':
case 'LINEFICHINTER_DELETE':
// Members
case 'MEMBER_CREATE':
case 'MEMBER_VALIDATE':
case 'MEMBER_SUBSCRIPTION':
case 'MEMBER_MODIFY':
case 'MEMBER_NEW_PASSWORD':
case 'MEMBER_RESILIATE':
case 'MEMBER_DELETE':
// Categories
case 'CATEGORY_CREATE':
case 'CATEGORY_MODIFY':
case 'CATEGORY_DELETE':
// Projects
case 'PROJECT_CREATE':
case 'PROJECT_MODIFY':
case 'PROJECT_DELETE':
// Project tasks
case 'TASK_CREATE':
case 'TASK_MODIFY':
case 'TASK_DELETE':
// Task time spent
case 'TASK_TIMESPENT_CREATE':
case 'TASK_TIMESPENT_MODIFY':
case 'TASK_TIMESPENT_DELETE':
// Shipping
case 'SHIPPING_CREATE':
case 'SHIPPING_MODIFY':
case 'SHIPPING_VALIDATE':
case 'SHIPPING_SENTBYMAIL':
case 'SHIPPING_DELETE':
case 'SHIPPING_BUILDDOC':
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
break;
}
return 0;
}
}

View File

@ -305,7 +305,7 @@ class CategorieTest extends PHPUnit_Framework_TestCase
$localobject=new Categorie($this->savdb);
$result=$localobject->fetch($id);
$result=$localobject->delete($id);
$result=$localobject->delete($user);
print __METHOD__." id=".$id." result=".$result."\n";
$this->assertGreaterThan(0, $result);