26 require_once DOL_DOCUMENT_ROOT.
'/core/triggers/dolibarrtriggers.class.php';
27 include_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
35 public $listofmanagedevents = array();
46 $this->
name = preg_replace(
'/^Interface/i',
'', get_class($this));
47 $this->family =
"notification";
48 $this->
description =
"Triggers of this module send email notifications according to Notification module setup.";
50 $this->version = self::VERSION_DOLIBARR;
51 $this->picto =
'email';
53 $this->listofmanagedevents = Notify::$arrayofnotifsupported;
69 if (empty($conf->notification) || empty($conf->notification->enabled)) {
73 if (!in_array($action, $this->listofmanagedevents)) {
77 dol_syslog(
"Trigger '".$this->
name.
"' for action '$action' launched by ".__FILE__.
". id=".$object->id);
80 $notify->send($action, $object);
97 if (!is_object($hookmanager)) {
98 include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
101 $hookmanager->initHooks(array(
'notification'));
103 $reshook = $hookmanager->executeHooks(
'notifsupported', $parameters, $object, $action);
104 if (empty($reshook)) {
105 if (!empty($hookmanager->resArray[
'arrayofnotifsupported'])) {
106 $this->listofmanagedevents = array_merge($this->listofmanagedevents, $hookmanager->resArray[
'arrayofnotifsupported']);
113 $sql =
"SELECT rowid, code, label, description, elementtype";
114 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_action_trigger";
115 $sql .= $this->
db->order(
"rang, elementtype, code");
117 dol_syslog(
"getListOfManagedEvents Get list of notifications", LOG_DEBUG);
123 $obj = $this->
db->fetch_object(
$resql);
127 if (in_array($obj->code, $this->listofmanagedevents)) {
133 $element = $obj->elementtype;
136 if ($element ==
'order_supplier' && ((empty($conf->fournisseur->enabled) && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_order->enabled))) {
138 } elseif ($element ==
'invoice_supplier' && ((empty($conf->fournisseur->enabled) && !empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)) || empty($conf->supplier_invoice->enabled))) {
140 } elseif ($element ==
'withdraw' && empty($conf->prelevement->enabled)) {
142 } elseif ($element ==
'shipping' && empty($conf->expedition->enabled)) {
144 } elseif ($element ==
'member' && empty($conf->adherent->enabled)) {
146 } elseif (($element ==
'expense_report' || $element ==
'expensereport') && empty($conf->expensereport->enabled)) {
148 } elseif (!in_array($element, array(
'order_supplier',
'invoice_supplier',
'withdraw',
'shipping',
'member',
'expense_report',
'expensereport')) && empty($conf->$element->enabled)) {
154 $ret[] = array(
'rowid'=>$obj->rowid,
'code'=>$obj->code,
'label'=>$obj->label,
'description'=>$obj->description,
'elementtype'=>$obj->elementtype);
runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
Function called when a Dolibarrr business event is done.
Class to stock current configuration.
Class to manage notifications.
Class of triggers for notification module.
$conf db
API class for accounts.
__construct($db)
Constructor.
Class to manage Dolibarr users.
$conf db name
Only used if Module[ID]Name translation string is not found.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
Class to manage translations.
Class that all the triggers must extend.
if(isModEnabled('facture')&&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur')&&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD)&&$user->rights->fournisseur->facture->lire)||(isModEnabled('supplier_invoice')&&$user->rights->supplier_invoice->lire)) if(isModEnabled('don')&&!empty($user->rights->don->lire)) if(isModEnabled('tax')&&!empty($user->rights->tax->charges->lire)) if(isModEnabled('facture')&&isModEnabled('commande')&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
print *****$script_file(".$version.") pid cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getListOfManagedEvents()
Return list of events managed by notification module.