Refactor InterfaceActionsAuto

This commit is contained in:
Marcos García de La Fuente 2014-07-18 04:10:43 +02:00
parent 0c4a3b23af
commit f8f9e0355c

View File

@ -36,11 +36,6 @@ class InterfaceActionsAuto extends DolibarrTriggers
public $version = self::VERSION_DOLIBARR; public $version = self::VERSION_DOLIBARR;
public $picto = 'action'; public $picto = 'action';
var $date;
var $duree;
var $texte;
var $desc;
/** /**
* Function called when a Dolibarrr business event is done. * Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers * All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
@ -64,38 +59,37 @@ class InterfaceActionsAuto extends DolibarrTriggers
*/ */
public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf) public function run_trigger($action, $object, User $user, Translate $langs, Conf $conf)
{ {
$key='MAIN_AGENDA_ACTIONAUTO_'.$action; // Module not active, we do nothing
//dol_syslog("xxxxxxxxxxx".$key); if (empty($conf->agenda->enabled)) {
return 0;
}
if (empty($conf->agenda->enabled)) return 0; // Module not active, we do nothing $key = 'MAIN_AGENDA_ACTIONAUTO_'.$action;
if (empty($conf->global->$key)) return 0; // Do not log events not enabled for this action
$ok=0; // Do not log events not enabled for this action
if (empty($conf->global->$key)) {
return 0;
}
$langs->load("agenda");
// Actions // Actions
if ($action == 'COMPANY_CREATE') if ($action == 'COMPANY_CREATE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("NewCompanyToDolibarr",$object->nom); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("NewCompanyToDolibarr",$object->nom);
$object->actionmsg=$langs->transnoentities("NewCompanyToDolibarr",$object->nom); $object->actionmsg=$langs->transnoentities("NewCompanyToDolibarr",$object->nom);
if (! empty($object->prefix)) $object->actionmsg.=" (".$object->prefix.")"; 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->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$object->socid=$object->id; $object->socid=$object->id;
$ok=1;
} }
elseif ($action == 'COMPANY_SENTBYMAIL') elseif ($action == 'COMPANY_SENTBYMAIL')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("orders"); $langs->load("orders");
$langs->load("agenda");
if (empty($object->actiontypecode)) $object->actiontypecode='AC_OTH_AUTO'; 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); if (empty($object->actionmsg2)) dol_syslog('Trigger called with property actionmsg2 on object not defined', LOG_ERR);
@ -103,14 +97,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Parameters $object->sendtoid defined by caller // Parameters $object->sendtoid defined by caller
//$object->sendtoid=0; //$object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'CONTRACT_VALIDATE') elseif ($action == 'CONTRACT_VALIDATE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("contracts"); $langs->load("contracts");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractValidatedInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ContractValidatedInDolibarr",$object->ref);
@ -118,13 +109,10 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'PROPAL_VALIDATE') elseif ($action == 'PROPAL_VALIDATE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("propal"); $langs->load("propal");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalValidatedInDolibarr",$object->ref);
@ -132,13 +120,10 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'PROPAL_SENTBYMAIL') elseif ($action == 'PROPAL_SENTBYMAIL')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("propal"); $langs->load("propal");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProposalSentByEMail",$object->ref);
@ -150,13 +135,10 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Parameters $object->sendtoid defined by caller // Parameters $object->sendtoid defined by caller
//$object->sendtoid=0; //$object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'PROPAL_CLOSE_SIGNED') elseif ($action == 'PROPAL_CLOSE_SIGNED')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("propal"); $langs->load("propal");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedSignedInDolibarr",$object->ref);
@ -164,13 +146,10 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'PROPAL_CLOSE_REFUSED') elseif ($action == 'PROPAL_CLOSE_REFUSED')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("propal"); $langs->load("propal");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("PropalClosedRefusedInDolibarr",$object->ref);
@ -178,13 +157,10 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'ORDER_VALIDATE') elseif ($action == 'ORDER_VALIDATE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("orders"); $langs->load("orders");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref);
@ -192,13 +168,10 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'ORDER_SENTBYMAIL') elseif ($action == 'ORDER_SENTBYMAIL')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("orders"); $langs->load("orders");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderSentByEMail",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderSentByEMail",$object->ref);
@ -210,14 +183,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Parameters $object->sendtoid defined by caller // Parameters $object->sendtoid defined by caller
//$object->sendtoid=0; //$object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'BILL_VALIDATE') elseif ($action == 'BILL_VALIDATE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("bills"); $langs->load("bills");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref);
@ -225,14 +195,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'BILL_UNVALIDATE') elseif ($action == 'BILL_UNVALIDATE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("bills"); $langs->load("bills");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceBackToDraftInDolibarr",$object->ref);
@ -240,14 +207,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'BILL_SENTBYMAIL') elseif ($action == 'BILL_SENTBYMAIL')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("bills"); $langs->load("bills");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceSentByEMail",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceSentByEMail",$object->ref);
@ -259,14 +223,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Parameters $object->sendtoid defined by caller // Parameters $object->sendtoid defined by caller
//$object->sendtoid=0; //$object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'BILL_PAYED') elseif ($action == 'BILL_PAYED')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("bills"); $langs->load("bills");
$langs->load("agenda");
// Values for this action can't be defined by caller. // Values for this action can't be defined by caller.
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
@ -275,14 +236,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'BILL_CANCEL') elseif ($action == 'BILL_CANCEL')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("bills"); $langs->load("bills");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref);
@ -290,14 +248,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'FICHINTER_VALIDATE') elseif ($action == 'FICHINTER_VALIDATE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("interventions"); $langs->load("interventions");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionValidatedInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionValidatedInDolibarr",$object->ref);
@ -307,14 +262,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->sendtoid=0; $object->sendtoid=0;
$object->fk_element=0; $object->fk_element=0;
$object->elementtype=''; $object->elementtype='';
$ok=1;
} }
elseif ($action == 'FICHINTER_SENTBYMAIL') elseif ($action == 'FICHINTER_SENTBYMAIL')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("interventions"); $langs->load("interventions");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionSentByEMail",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionSentByEMail",$object->ref);
@ -323,14 +275,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Parameters $object->sendtoid defined by caller // Parameters $object->sendtoid defined by caller
//$object->sendtoid=0; //$object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'FICHINTER_CLASSIFY_BILLED') elseif ($action == 'FICHINTER_CLASSIFY_BILLED')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("interventions"); $langs->load("interventions");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedBilled",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InterventionClassifiedBilled",$object->ref);
@ -338,14 +287,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'SHIPPING_VALIDATE') elseif ($action == 'SHIPPING_VALIDATE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("sendings"); $langs->load("sendings");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingValidated",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingValidated",$object->ref);
@ -357,14 +303,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Parameters $object->sendtoid defined by caller // Parameters $object->sendtoid defined by caller
//$object->sendtoid=0; //$object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'SHIPPING_SENTBYMAIL') elseif ($action == 'SHIPPING_SENTBYMAIL')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("sendings"); $langs->load("sendings");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingSentByEMail",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ShippingSentByEMail",$object->ref);
@ -376,13 +319,10 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Parameters $object->sendtoid defined by caller // Parameters $object->sendtoid defined by caller
//$object->sendtoid=0; //$object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'ORDER_SUPPLIER_VALIDATE') elseif ($action == 'ORDER_SUPPLIER_VALIDATE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("orders"); $langs->load("orders");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderValidatedInDolibarr",$object->ref);
@ -390,13 +330,10 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'ORDER_SUPPLIER_APPROVE') elseif ($action == 'ORDER_SUPPLIER_APPROVE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("orders"); $langs->load("orders");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderApprovedInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderApprovedInDolibarr",$object->ref);
@ -404,13 +341,10 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'ORDER_SUPPLIER_REFUSE') elseif ($action == 'ORDER_SUPPLIER_REFUSE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("orders"); $langs->load("orders");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderRefusedInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("OrderRefusedInDolibarr",$object->ref);
@ -418,14 +352,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("bills"); $langs->load("bills");
$langs->load("agenda");
$langs->load("orders"); $langs->load("orders");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
@ -438,14 +369,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Parameters $object->sendtoid defined by caller // Parameters $object->sendtoid defined by caller
//$object->sendtoid=0; //$object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'BILL_SUPPLIER_VALIDATE') elseif ($action == 'BILL_SUPPLIER_VALIDATE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("bills"); $langs->load("bills");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceValidatedInDolibarr",$object->ref);
@ -453,14 +381,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL') elseif ($action == 'BILL_SUPPLIER_SENTBYMAIL')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("bills"); $langs->load("bills");
$langs->load("agenda");
$langs->load("orders"); $langs->load("orders");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
@ -473,14 +398,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
// Parameters $object->sendtoid defined by caller // Parameters $object->sendtoid defined by caller
//$object->sendtoid=0; //$object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'BILL_SUPPLIER_PAYED') elseif ($action == 'BILL_SUPPLIER_PAYED')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("bills"); $langs->load("bills");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoicePaidInDolibarr",$object->ref);
@ -488,14 +410,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'BILL_SUPPLIER_CANCELED') elseif ($action == 'BILL_SUPPLIER_CANCELED')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("bills"); $langs->load("bills");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("InvoiceCanceledInDolibarr",$object->ref);
@ -503,16 +422,13 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
// Members // Members
elseif ($action == 'MEMBER_VALIDATE') elseif ($action == 'MEMBER_VALIDATE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("members"); $langs->load("members");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberValidatedInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberValidatedInDolibarr",$object->ref);
@ -522,14 +438,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'MEMBER_SUBSCRIPTION') elseif ($action == 'MEMBER_SUBSCRIPTION')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("members"); $langs->load("members");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberSubscriptionAddedInDolibarr",$object->ref);
@ -541,18 +454,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $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') elseif ($action == 'MEMBER_RESILIATE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("members"); $langs->load("members");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberResiliatedInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberResiliatedInDolibarr",$object->ref);
@ -562,14 +468,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
elseif ($action == 'MEMBER_DELETE') elseif ($action == 'MEMBER_DELETE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("members"); $langs->load("members");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberDeletedInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("MemberDeletedInDolibarr",$object->ref);
@ -579,16 +482,13 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
// Projects // Projects
elseif ($action == 'PROJECT_CREATE') elseif ($action == 'PROJECT_CREATE')
{ {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("projects"); $langs->load("projects");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("ProjectCreatedInDolibarr",$object->ref);
@ -597,15 +497,12 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
// Project tasks // Project tasks
elseif($action == 'TASK_CREATE') { elseif($action == 'TASK_CREATE') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("projects"); $langs->load("projects");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
@ -615,14 +512,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
elseif($action == 'TASK_MODIFY') { elseif($action == 'TASK_MODIFY') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("projects"); $langs->load("projects");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskModifiedInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskModifiedInDolibarr",$object->ref);
@ -631,14 +525,11 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
elseif($action == 'TASK_DELETE') { elseif($action == 'TASK_DELETE') {
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$langs->load("projects"); $langs->load("projects");
$langs->load("agenda");
$object->actiontypecode='AC_OTH_AUTO'; $object->actiontypecode='AC_OTH_AUTO';
if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskDeletedInDolibarr",$object->ref); if (empty($object->actionmsg2)) $object->actionmsg2=$langs->transnoentities("TaskDeletedInDolibarr",$object->ref);
@ -647,7 +538,6 @@ class InterfaceActionsAuto extends DolibarrTriggers
$object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login; $object->actionmsg.="\n".$langs->transnoentities("Author").': '.$user->login;
$object->sendtoid=0; $object->sendtoid=0;
$ok=1;
} }
// The trigger was enabled but we are missing the implementation, let the log know // The trigger was enabled but we are missing the implementation, let the log know
@ -657,9 +547,9 @@ class InterfaceActionsAuto extends DolibarrTriggers
return 0; return 0;
} }
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
// Add entry in event table // Add entry in event table
if ($ok)
{
$now=dol_now(); $now=dol_now();
if(isset($_SESSION['listofnames'])) if(isset($_SESSION['listofnames']))
@ -714,7 +604,6 @@ class InterfaceActionsAuto extends DolibarrTriggers
dol_syslog("interface_modAgenda_ActionsAuto.class.php: ".$this->error, LOG_ERR); dol_syslog("interface_modAgenda_ActionsAuto.class.php: ".$this->error, LOG_ERR);
return -1; return -1;
} }
}
return 0; return 0;
} }