27require_once DOL_DOCUMENT_ROOT.
'/core/triggers/dolibarrtriggers.class.php';
 
   28include_once DOL_DOCUMENT_ROOT.
'/core/class/notify.class.php';
 
   39  public $listofmanagedevents = array();
 
   50    $this->
name = preg_replace(
'/^Interface/i', 
'', get_class($this));
 
   51    $this->family = 
"notification";
 
   52    $this->
description = 
"Triggers of this module send Email notifications according to Notification module setup.";
 
   53    $this->version = self::VERSIONS[
'prod'];
 
   54    $this->picto = 
'email';
 
   56    $this->listofmanagedevents = Notify::$arrayofnotifsupported;
 
 
   74    if (empty(
$conf->notification) || !isModEnabled(
'notification')) {
 
   78    if (!is_object($hookmanager)) {
 
   79      include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
 
   82    $hookmanager->initHooks(array(
'notification'));
 
   84    $parameters = array();
 
   85    $reshook = $hookmanager->executeHooks(
'notifsupported', $parameters, 
$object, $action);
 
   86    if (empty($reshook)) {
 
   87      if (!empty($hookmanager->resArray[
'arrayofnotifsupported'])) {
 
   88        $this->listofmanagedevents = array_merge($this->listofmanagedevents, $hookmanager->resArray[
'arrayofnotifsupported']);
 
   93    if (!in_array($action, $this->listofmanagedevents)) {
 
   97    dol_syslog(
"Trigger '".$this->
name.
"' for action '".$action.
"' launched by ".__FILE__.
". id=".
$object->id);
 
   99    $notify = 
new Notify($this->db);
 
  100    $notify->send($action, 
$object);
 
 
  112    global 
$conf, $action;
 
  115    if (!is_object($hookmanager)) {
 
  116      include_once DOL_DOCUMENT_ROOT.
'/core/class/hookmanager.class.php';
 
  119    $hookmanager->initHooks(array(
'notification'));
 
  121    $parameters = array();
 
  123    $reshook = $hookmanager->executeHooks(
'notifsupported', $parameters, 
$object, $action);
 
  124    if (empty($reshook)) {
 
  125      if (!empty($hookmanager->resArray[
'arrayofnotifsupported'])) {
 
  126        $this->listofmanagedevents = array_merge($this->listofmanagedevents, $hookmanager->resArray[
'arrayofnotifsupported']);
 
  133    $sql = 
"SELECT rowid, code, contexts, label, description, elementtype";
 
  134    $sql .= 
" FROM ".MAIN_DB_PREFIX.
"c_action_trigger";
 
  135    $sql .= $this->db->order(
"rang, elementtype, code");
 
  137    dol_syslog(
"getListOfManagedEvents Get list of notifications", LOG_DEBUG);
 
  138    $resql = $this->db->query($sql);
 
  140      $num = $this->db->num_rows($resql);
 
  143        $obj = $this->db->fetch_object($resql);
 
  147        if (in_array($obj->code, $this->listofmanagedevents)) {
 
  153          $element = $obj->elementtype;
 
  156          if ($element == 
'order_supplier' && !isModEnabled(
'supplier_order')) {
 
  158          } elseif ($element == 
'invoice_supplier' && !isModEnabled(
'supplier_invoice')) {
 
  160          } elseif ($element == 
'withdraw' && !isModEnabled(
'prelevement')) {
 
  162          } elseif ($element == 
'shipping' && !isModEnabled(
'shipping')) {
 
  164          } elseif ($element == 
'member' && !isModEnabled(
'member')) {
 
  166          } elseif (($element == 
'expense_report' || $element == 
'expensereport') && !isModEnabled(
'expensereport')) {
 
  168          } elseif (!in_array($element, array(
'order_supplier', 
'invoice_supplier', 
'withdraw', 
'shipping', 
'member', 
'expense_report', 
'expensereport')) && empty(
$conf->$element->enabled)) {
 
  174          $ret[] = array(
'rowid' => $obj->rowid, 
'code' => $obj->code, 
'contexts' => $obj->contexts, 
'label' => $obj->label, 
'description' => $obj->description, 
'elementtype' => $obj->elementtype);
 
 
 
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
 
Class to stock current configuration.
 
Class that all triggers must inherit.
 
Class of triggers for notification module.
 
__construct($db)
Constructor.
 
getListOfManagedEvents()
Return list of events managed by notification module.
 
runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
Function called when a Dolibarr business event is done.
 
Class to manage the table of subscription to notifications.
 
Class to manage translations.
 
Class to manage Dolibarr users.
 
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as description
Only used if Module[ID]Desc translation string is not found.
 
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
 
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
 
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
 
$conf db name
Only used if Module[ID]Name translation string is not found.