dolibarr  17.0.4
notify.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
3  * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
4  * Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
5  * Copyright (C) 2018 Philippe Grand <philippe.grand@atoo-net.com>
6  * Copyright (C) 2021 Thibault FOUCART <support@ptibogxiv.net>
7  * Copyright (C) 2022 Anthony Berton <anthony.berton@bb2a.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 3 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program. If not, see <https://www.gnu.org/licenses/>.
21  */
22 
28 require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
29 
33 class Notify
34 {
38  public $id;
39 
43  public $db;
44 
48  public $error = '';
49 
53  public $errors = array();
54 
55  public $author;
56  public $ref;
57  public $date;
58  public $duree;
59  public $note;
60 
64  public $fk_project;
65 
66  // This codes actions are defined into table llx_notify_def
67  static public $arrayofnotifsupported = array(
68  'BILL_VALIDATE',
69  'BILL_PAYED',
70  'ORDER_CREATE',
71  'ORDER_VALIDATE',
72  'PROPAL_VALIDATE',
73  'PROPAL_CLOSE_SIGNED',
74  'FICHINTER_VALIDATE',
75  'FICHINTER_ADD_CONTACT',
76  'ORDER_SUPPLIER_VALIDATE',
77  'ORDER_SUPPLIER_APPROVE',
78  'ORDER_SUPPLIER_REFUSE',
79  'SHIPPING_VALIDATE',
80  'EXPENSE_REPORT_VALIDATE',
81  'EXPENSE_REPORT_APPROVE',
82  'HOLIDAY_VALIDATE',
83  'HOLIDAY_APPROVE',
84  'ACTION_CREATE'
85  );
86 
92  public function __construct($db)
93  {
94  $this->db = $db;
95  }
96 
97 
107  public function confirmMessage($action, $socid, $object)
108  {
109  global $conf, $langs;
110  $langs->load("mails");
111 
112  // Get full list of all notifications subscribed for $action, $socid and $object
113  $listofnotiftodo = $this->getNotificationsArray($action, $socid, $object, 0);
114 
115  if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_USER)) {
116  foreach ($listofnotiftodo as $val) {
117  if ($val['type'] == 'touser') {
118  unset($listofnotiftodo[$val['email']]);
119  //$listofnotiftodo = array_merge($listofnotiftodo);
120  }
121  }
122  }
123  if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_CONTACT)) {
124  foreach ($listofnotiftodo as $val) {
125  if ($val['type'] == 'tocontact') {
126  unset($listofnotiftodo[$val['email']]);
127  //$listofnotiftodo = array_merge($listofnotiftodo);
128  }
129  }
130  }
131  if (!empty($conf->global->NOTIFICATION_EMAIL_DISABLE_CONFIRM_MESSAGE_FIX)) {
132  foreach ($listofnotiftodo as $val) {
133  if ($val['type'] == 'tofixedemail') {
134  unset($listofnotiftodo[$val['email']]);
135  //$listofnotiftodo = array_merge($listofnotiftodo);
136  }
137  }
138  }
139 
140  $texte = '';
141  $nb = -1;
142  if (is_array($listofnotiftodo)) {
143  $nb = count($listofnotiftodo);
144  }
145  if ($nb < 0) {
146  $texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("ErrorFailedToGetListOfNotificationsToSend");
147  } elseif ($nb == 0) {
148  $texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("NoNotificationsWillBeSent");
149  } elseif ($nb == 1) {
150  $texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("ANotificationsWillBeSent");
151  } elseif ($nb >= 2) {
152  $texte = img_object($langs->trans("Notifications"), 'email').' '.$langs->trans("SomeNotificationsWillBeSent", $nb);
153  }
154 
155  if (is_array($listofnotiftodo)) {
156  $i = 0;
157  foreach ($listofnotiftodo as $val) {
158  if ($i) {
159  $texte .= ', ';
160  } else {
161  $texte .= ' (';
162  }
163  if ($val['isemailvalid']) {
164  $texte .= $val['email'];
165  } else {
166  $texte .= $val['emaildesc'];
167  }
168  $i++;
169  }
170  if ($i) {
171  $texte .= ')';
172  }
173  }
174 
175  return $texte;
176  }
177 
188  public function getNotificationsArray($notifcode, $socid = 0, $object = null, $userid = 0, $scope = array('thirdparty', 'user', 'global'))
189  {
190  global $conf, $user;
191 
192  $error = 0;
193  $resarray = array();
194 
195  $valueforthreshold = 0;
196  if (is_object($object)) {
197  $valueforthreshold = $object->total_ht;
198  }
199 
200  $sqlnotifcode = '';
201  if ($notifcode) {
202  if (is_numeric($notifcode)) {
203  $sqlnotifcode = " AND n.fk_action = ".((int) $notifcode); // Old usage
204  } else {
205  $sqlnotifcode = " AND a.code = '".$this->db->escape($notifcode)."'"; // New usage
206  }
207  }
208 
209  if (!$error) {
210  if ($socid >= 0 && in_array('thirdparty', $scope)) {
211  $sql = "SELECT a.code, c.email, c.rowid";
212  $sql .= " FROM ".$this->db->prefix()."notify_def as n,";
213  $sql .= " ".$this->db->prefix()."socpeople as c,";
214  $sql .= " ".$this->db->prefix()."c_action_trigger as a,";
215  $sql .= " ".$this->db->prefix()."societe as s";
216  $sql .= " WHERE n.fk_contact = c.rowid";
217  $sql .= " AND a.rowid = n.fk_action";
218  $sql .= " AND n.fk_soc = s.rowid";
219  $sql .= $sqlnotifcode;
220  $sql .= " AND s.entity IN (".getEntity('societe').")";
221  if ($socid > 0) {
222  $sql .= " AND s.rowid = ".((int) $socid);
223  }
224 
225  dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG);
226 
227  $resql = $this->db->query($sql);
228  if ($resql) {
229  $num = $this->db->num_rows($resql);
230  $i = 0;
231  while ($i < $num) {
232  $obj = $this->db->fetch_object($resql);
233  if ($obj) {
234  $newval2 = trim($obj->email);
235  $isvalid = isValidEmail($newval2);
236  if (empty($resarray[$newval2])) {
237  $resarray[$newval2] = array('type'=> 'tocontact', 'code'=>trim($obj->code), 'emaildesc'=>'Contact id '.$obj->rowid, 'email'=>$newval2, 'contactid'=>$obj->rowid, 'isemailvalid'=>$isvalid);
238  }
239  }
240  $i++;
241  }
242  } else {
243  $error++;
244  $this->error = $this->db->lasterror();
245  }
246  }
247  }
248 
249  if (!$error) {
250  if ($userid >= 0 && in_array('user', $scope)) {
251  $sql = "SELECT a.code, c.email, c.rowid";
252  $sql .= " FROM ".$this->db->prefix()."notify_def as n,";
253  $sql .= " ".$this->db->prefix()."user as c,";
254  $sql .= " ".$this->db->prefix()."c_action_trigger as a";
255  $sql .= " WHERE n.fk_user = c.rowid";
256  $sql .= " AND a.rowid = n.fk_action";
257  $sql .= $sqlnotifcode;
258  $sql .= " AND c.entity IN (".getEntity('user').")";
259  if ($userid > 0) {
260  $sql .= " AND c.rowid = ".((int) $userid);
261  }
262 
263  dol_syslog(__METHOD__." ".$notifcode.", ".$socid."", LOG_DEBUG);
264 
265  $resql = $this->db->query($sql);
266  if ($resql) {
267  $num = $this->db->num_rows($resql);
268  $i = 0;
269  while ($i < $num) {
270  $obj = $this->db->fetch_object($resql);
271  if ($obj) {
272  $newval2 = trim($obj->email);
273  $isvalid = isValidEmail($newval2);
274  if (empty($resarray[$newval2])) {
275  $resarray[$newval2] = array('type'=> 'touser', 'code'=>trim($obj->code), 'emaildesc'=>'User id '.$obj->rowid, 'email'=>$newval2, 'userid'=>$obj->rowid, 'isemailvalid'=>$isvalid);
276  }
277  }
278  $i++;
279  }
280  } else {
281  $error++;
282  $this->error = $this->db->lasterror();
283  }
284  }
285  }
286 
287  if (!$error) {
288  if (in_array('global', $scope)) {
289  // List of notifications enabled for fixed email
290  foreach ($conf->global as $key => $val) {
291  if ($notifcode) {
292  if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) {
293  continue;
294  }
295  } else {
296  if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_.*_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) {
297  continue;
298  }
299  }
300 
301  $threshold = (float) $reg[1];
302  if ($valueforthreshold < $threshold) {
303  continue;
304  }
305 
306  $tmpemail = explode(',', $val);
307  foreach ($tmpemail as $key2 => $val2) {
308  $newval2 = trim($val2);
309  if ($newval2 == '__SUPERVISOREMAIL__') {
310  if ($user->fk_user > 0) {
311  $tmpuser = new User($this->db);
312  $tmpuser->fetch($user->fk_user);
313  if ($tmpuser->email) {
314  $newval2 = trim($tmpuser->email);
315  } else {
316  $newval2 = '';
317  }
318  } else {
319  $newval2 = '';
320  }
321  }
322  if ($newval2) {
323  $isvalid = isValidEmail($newval2, 0);
324  if (empty($resarray[$newval2])) {
325  $resarray[$newval2] = array('type'=> 'tofixedemail', 'code'=>trim($key), 'emaildesc'=>trim($val2), 'email'=>$newval2, 'isemailvalid'=>$isvalid);
326  }
327  }
328  }
329  }
330  }
331  }
332 
333  if ($error) {
334  return -1;
335  }
336 
337  //var_dump($resarray);
338  return $resarray;
339  }
340 
352  public function send($notifcode, $object, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array())
353  {
354  global $user, $conf, $langs, $mysoc;
355  global $hookmanager;
356  global $dolibarr_main_url_root;
357  global $action;
358 
359  if (!is_object($hookmanager)) {
360  include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
361  $hookmanager = new HookManager($this->db);
362  }
363  $hookmanager->initHooks(array('notification'));
364 
365  $parameters = array('notifcode' => $notifcode);
366  $reshook = $hookmanager->executeHooks('notifsupported', $parameters, $object, $action);
367  if (empty($reshook)) {
368  if (!empty($hookmanager->resArray['arrayofnotifsupported'])) {
369  Notify::$arrayofnotifsupported = array_merge(Notify::$arrayofnotifsupported, $hookmanager->resArray['arrayofnotifsupported']);
370  }
371  }
372 
373  if (!in_array($notifcode, Notify::$arrayofnotifsupported)) {
374  return 0;
375  }
376 
377  include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
378 
379  dol_syslog(get_class($this)."::send notifcode=".$notifcode.", object=".$object->id);
380 
381  $langs->load("other");
382 
383  // Define $urlwithroot
384  $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
385  $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
386  //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
387 
388  // Define some vars
389  $application = 'Dolibarr';
390  if (!empty($conf->global->MAIN_APPLICATION_TITLE)) {
391  $application = $conf->global->MAIN_APPLICATION_TITLE;
392  }
393  $replyto = $conf->notification->email_from;
394  $object_type = '';
395  $link = '';
396  $num = 0;
397  $error = 0;
398 
399  $oldref = (empty($object->oldref) ? $object->ref : $object->oldref);
400  $newref = (empty($object->newref) ? $object->ref : $object->newref);
401 
402  $sql = '';
403 
404  // Check notification per third party
405  if (!empty($object->socid) && $object->socid > 0) {
406  $sql .= "SELECT 'tocontactid' as type_target, c.email, c.rowid as cid, c.lastname, c.firstname, c.default_lang,";
407  $sql .= " a.rowid as adid, a.label, a.code, n.rowid, n.type";
408  $sql .= " FROM ".$this->db->prefix()."socpeople as c,";
409  $sql .= " ".$this->db->prefix()."c_action_trigger as a,";
410  $sql .= " ".$this->db->prefix()."notify_def as n,";
411  $sql .= " ".$this->db->prefix()."societe as s";
412  $sql .= " WHERE n.fk_contact = c.rowid AND a.rowid = n.fk_action";
413  $sql .= " AND n.fk_soc = s.rowid";
414  $sql .= " AND c.statut = 1";
415  if (is_numeric($notifcode)) {
416  $sql .= " AND n.fk_action = ".((int) $notifcode); // Old usage
417  } else {
418  $sql .= " AND a.code = '".$this->db->escape($notifcode)."'"; // New usage
419  }
420  $sql .= " AND s.rowid = ".((int) $object->socid);
421 
422  $sql .= "\nUNION\n";
423  }
424 
425  // Check notification per user
426  $sql .= "SELECT 'touserid' as type_target, c.email, c.rowid as cid, c.lastname, c.firstname, c.lang as default_lang,";
427  $sql .= " a.rowid as adid, a.label, a.code, n.rowid, n.type";
428  $sql .= " FROM ".$this->db->prefix()."user as c,";
429  $sql .= " ".$this->db->prefix()."c_action_trigger as a,";
430  $sql .= " ".$this->db->prefix()."notify_def as n";
431  $sql .= " WHERE n.fk_user = c.rowid AND a.rowid = n.fk_action";
432  $sql .= " AND c.statut = 1";
433  if (is_numeric($notifcode)) {
434  $sql .= " AND n.fk_action = ".((int) $notifcode); // Old usage
435  } else {
436  $sql .= " AND a.code = '".$this->db->escape($notifcode)."'"; // New usage
437  }
438 
439  $result = $this->db->query($sql);
440  if ($result) {
441  $num = $this->db->num_rows($result);
442  $projtitle = '';
443  if (!empty($object->fk_project)) {
444  require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
445  $proj = new Project($this->db);
446  $proj->fetch($object->fk_project);
447  $projtitle = '('.$proj->title.')';
448  }
449 
450  if ($num > 0) {
451  $i = 0;
452  while ($i < $num && !$error) { // For each notification couple defined (third party/actioncode)
453  $obj = $this->db->fetch_object($result);
454 
455  $sendto = dolGetFirstLastname($obj->firstname, $obj->lastname)." <".$obj->email.">";
456  $notifcodedefid = $obj->adid;
457  $trackid = '';
458  if ($obj->type_target == 'tocontactid') {
459  $trackid = 'ctc'.$obj->cid;
460  }
461  if ($obj->type_target == 'touserid') {
462  $trackid = 'use'.$obj->cid;
463  }
464 
465  if (dol_strlen($obj->email)) {
466  // Set output language
467  $outputlangs = $langs;
468  if ($obj->default_lang && $obj->default_lang != $langs->defaultlang) {
469  $outputlangs = new Translate('', $conf);
470  $outputlangs->setDefaultLang($obj->default_lang);
471  $outputlangs->loadLangs(array("main", "other"));
472  }
473 
474  $subject = '['.$mysoc->name.'] '.$outputlangs->transnoentitiesnoconv("DolibarrNotification").($projtitle ? ' '.$projtitle : '');
475 
476  switch ($notifcode) {
477  case 'BILL_VALIDATE':
478  $link = '<a href="'.$urlwithroot.'/compta/facture/card.php?facid='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
479  $dir_output = $conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice');
480  $object_type = 'facture';
481  $labeltouse = $conf->global->BILL_VALIDATE_TEMPLATE;
482  $mesg = $outputlangs->transnoentitiesnoconv("EMailTextInvoiceValidated", $link);
483  break;
484  case 'BILL_PAYED':
485  $link = '<a href="'.$urlwithroot.'/compta/facture/card.php?facid='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
486  $dir_output = $conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice');
487  $object_type = 'facture';
488  $labeltouse = $conf->global->BILL_PAYED_TEMPLATE;
489  $mesg = $outputlangs->transnoentitiesnoconv("EMailTextInvoicePayed", $link);
490  break;
491  case 'ORDER_VALIDATE':
492  $link = '<a href="'.$urlwithroot.'/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
493  $dir_output = $conf->commande->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'commande');
494  $object_type = 'order';
495  $labeltouse = $conf->global->ORDER_VALIDATE_TEMPLATE;
496  $mesg = $outputlangs->transnoentitiesnoconv("EMailTextOrderValidated", $link);
497  break;
498  case 'PROPAL_VALIDATE':
499  $link = '<a href="'.$urlwithroot.'/comm/propal/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
500  $dir_output = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal');
501  $object_type = 'propal';
502  $labeltouse = $conf->global->PROPAL_VALIDATE_TEMPLATE;
503  $mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalValidated", $link);
504  break;
505  case 'PROPAL_CLOSE_SIGNED':
506  $link = '<a href="'.$urlwithroot.'/comm/propal/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
507  $dir_output = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal');
508  $object_type = 'propal';
509  $labeltouse = $conf->global->PROPAL_CLOSE_SIGNED_TEMPLATE;
510  $mesg = $outputlangs->transnoentitiesnoconv("EMailTextProposalClosedSigned", $link);
511  break;
512  case 'FICHINTER_ADD_CONTACT':
513  $link = '<a href="'.$urlwithroot.'/fichinter/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
514  $dir_output = $conf->ficheinter->dir_output;
515  $object_type = 'ficheinter';
516  $mesg = $outputlangs->transnoentitiesnoconv("EMailTextInterventionAddedContact", $link);
517  break;
518  case 'FICHINTER_VALIDATE':
519  $link = '<a href="'.$urlwithroot.'/fichinter/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
520  $dir_output = $conf->ficheinter->dir_output;
521  $object_type = 'ficheinter';
522  $mesg = $outputlangs->transnoentitiesnoconv("EMailTextInterventionValidated", $link);
523  break;
524  case 'ORDER_SUPPLIER_VALIDATE':
525  $link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
526  $dir_output = $conf->fournisseur->commande->dir_output;
527  $object_type = 'order_supplier';
528  $labeltouse = isset($conf->global->ORDER_SUPPLIER_VALIDATE_TEMPLATE) ? $conf->global->ORDER_SUPPLIER_VALIDATE_TEMPLATE : '';
529  $mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n";
530  $mesg .= $outputlangs->transnoentitiesnoconv("EMailTextOrderValidatedBy", $link, $user->getFullName($outputlangs));
531  $mesg .= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n";
532  break;
533  case 'ORDER_SUPPLIER_APPROVE':
534  $link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
535  $dir_output = $conf->fournisseur->commande->dir_output;
536  $object_type = 'order_supplier';
537  $labeltouse = isset($conf->global->ORDER_SUPPLIER_APPROVE_TEMPLATE) ? $conf->global->ORDER_SUPPLIER_APPROVE_TEMPLATE : '';
538  $mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n";
539  $mesg .= $outputlangs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $link, $user->getFullName($outputlangs));
540  $mesg .= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n";
541  break;
542  case 'ORDER_SUPPLIER_REFUSE':
543  $link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
544  $dir_output = $conf->fournisseur->commande->dir_output;
545  $object_type = 'order_supplier';
546  $labeltouse = isset($conf->global->ORDER_SUPPLIER_REFUSE_TEMPLATE) ? $conf->global->ORDER_SUPPLIER_REFUSE_TEMPLATE : '';
547  $mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n";
548  $mesg .= $outputlangs->transnoentitiesnoconv("EMailTextOrderRefusedBy", $link, $user->getFullName($outputlangs));
549  $mesg .= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n";
550  break;
551  case 'SHIPPING_VALIDATE':
552  $link = '<a href="'.$urlwithroot.'/expedition/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
553  $dir_output = $conf->expedition->dir_output."/sending/".get_exdir(0, 0, 0, 1, $object, 'shipment');
554  $object_type = 'shipping';
555  $labeltouse = $conf->global->SHIPPING_VALIDATE_TEMPLATE;
556  $mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpeditionValidated", $link);
557  break;
558  case 'EXPENSE_REPORT_VALIDATE':
559  $link = '<a href="'.$urlwithroot.'/expensereport/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
560  $dir_output = $conf->expensereport->dir_output;
561  $object_type = 'expensereport';
562  $labeltouse = $conf->global->EXPENSE_REPORT_VALIDATE_TEMPLATE;
563  $mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpenseReportValidated", $link);
564  break;
565  case 'EXPENSE_REPORT_APPROVE':
566  $link = '<a href="'.$urlwithroot.'/expensereport/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
567  $dir_output = $conf->expensereport->dir_output;
568  $object_type = 'expensereport';
569  $labeltouse = $conf->global->EXPENSE_REPORT_APPROVE_TEMPLATE;
570  $mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpenseReportApproved", $link);
571  break;
572  case 'HOLIDAY_VALIDATE':
573  $link = '<a href="'.$urlwithroot.'/holiday/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
574  $dir_output = $conf->holiday->dir_output;
575  $object_type = 'holiday';
576  $labeltouse = $conf->global->HOLIDAY_VALIDATE_TEMPLATE;
577  $mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayValidated", $link);
578  break;
579  case 'HOLIDAY_APPROVE':
580  $link = '<a href="'.$urlwithroot.'/holiday/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
581  $dir_output = $conf->holiday->dir_output;
582  $object_type = 'holiday';
583  $labeltouse = $conf->global->HOLIDAY_APPROVE_TEMPLATE;
584  $mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayApproved", $link);
585  break;
586  case 'ACTION_CREATE':
587  $link = '<a href="'.$urlwithroot.'/comm/action/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
588  $dir_output = $conf->agenda->dir_output;
589  $object_type = 'action';
590  $labeltouse = $conf->global->ACTION_CREATE_TEMPLATE;
591  $mesg = $outputlangs->transnoentitiesnoconv("EMailTextActionAdded", $link);
592  break;
593  default:
594  $object_type = $object->element;
595  $dir_output = $conf->$object_type->multidir_output[$object->entity ? $object->entity : $conf->entity]."/".get_exdir(0, 0, 0, 1, $object, $object_type);
596  $template = $notifcode.'_TEMPLATE';
597  $labeltouse = $conf->global->$template;
598  $mesg = $outputlangs->transnoentitiesnoconv('Notify_'.$notifcode).' '.$newref.' '.$dir_output;
599  break;
600  }
601 
602  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
603  $formmail = new FormMail($this->db);
604  $arraydefaultmessage = null;
605 
606  if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($this->db, $object_type.'_send', $user, $outputlangs, 0, 1, $labeltouse);
607  if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
608  $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
609  complete_substitutions_array($substitutionarray, $outputlangs, $object);
610  $subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs);
611  $message = make_substitutions($arraydefaultmessage->content, $substitutionarray, $outputlangs);
612  } else {
613  $message = $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification", $application, $mysoc->name)."\n";
614  $message .= $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification2", $application, $mysoc->name)."\n";
615  $message .= "\n";
616  $message .= $mesg;
617  }
618 
619  $ref = dol_sanitizeFileName($newref);
620  $pdf_path = $dir_output."/".$ref.".pdf";
621  if (!dol_is_file($pdf_path)||(is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0 && !$arraydefaultmessage->joinfiles)) {
622  // We can't add PDF as it is not generated yet.
623  $filepdf = '';
624  } else {
625  $filepdf = $pdf_path;
626  $filename_list[] = $filepdf;
627  $mimetype_list[] = mime_content_type($filepdf);
628  $mimefilename_list[] = $ref.".pdf";
629  }
630 
631  $labeltouse = !empty($labeltouse) ? $labeltouse : '';
632 
633  $parameters = array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list, 'outputlangs'=>$outputlangs, 'labeltouse'=>$labeltouse);
634  if (!isset($action)) {
635  $action = '';
636  }
637 
638  $reshook = $hookmanager->executeHooks('formatNotificationMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
639  if (empty($reshook)) {
640  if (!empty($hookmanager->resArray['files'])) {
641  $filename_list = $hookmanager->resArray['files']['file'];
642  $mimetype_list = $hookmanager->resArray['files']['mimefile'];
643  $mimefilename_list = $hookmanager->resArray['files']['filename'];
644  }
645  if (!empty($hookmanager->resArray['subject'])) {
646  $subject .= $hookmanager->resArray['subject'];
647  }
648  if (!empty($hookmanager->resArray['message'])) {
649  $message .= $hookmanager->resArray['message'];
650  }
651  }
652 
653  $mailfile = new CMailFile(
654  $subject,
655  $sendto,
656  $replyto,
657  $message,
658  $filename_list,
659  $mimetype_list,
660  $mimefilename_list,
661  '',
662  '',
663  0,
664  -1,
665  '',
666  '',
667  $trackid,
668  '',
669  'notification'
670  );
671 
672  if ($mailfile->sendfile()) {
673  if ($obj->type_target == 'touserid') {
674  $sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_user, type, objet_type, type_target, objet_id, email)";
675  $sql .= " VALUES ('".$this->db->idate(dol_now())."', ".((int) $notifcodedefid).", ".($object->socid > 0 ? ((int) $object->socid) : 'null').", ".((int) $obj->cid).", '".$this->db->escape($obj->type)."', '".$this->db->escape($object_type)."', '".$this->db->escape($obj->type_target)."', ".((int) $object->id).", '".$this->db->escape($obj->email)."')";
676  } else {
677  $sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, type_target, objet_id, email)";
678  $sql .= " VALUES ('".$this->db->idate(dol_now())."', ".((int) $notifcodedefid).", ".($object->socid > 0 ? ((int) $object->socid) : 'null').", ".((int) $obj->cid).", '".$this->db->escape($obj->type)."', '".$this->db->escape($object_type)."', '".$this->db->escape($obj->type_target)."', ".((int) $object->id).", '".$this->db->escape($obj->email)."')";
679  }
680  if (!$this->db->query($sql)) {
681  dol_print_error($this->db);
682  }
683  } else {
684  $error++;
685  $this->errors[] = $mailfile->error;
686  }
687  } else {
688  dol_syslog("No notification sent for ".$sendto." because email is empty");
689  }
690  $i++;
691  }
692  } else {
693  dol_syslog("No notification to thirdparty sent, nothing into notification setup for the thirdparty socid = ".(empty($object->socid) ? '' : $object->socid));
694  }
695  } else {
696  $error++;
697  $this->errors[] = $this->db->lasterror();
698  dol_syslog("Failed to get list of notification to send ".$this->db->lasterror(), LOG_ERR);
699  return -1;
700  }
701 
702  // Check notification using fixed email
703  if (!$error) {
704  foreach ($conf->global as $key => $val) {
705  $reg = array();
706  if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) {
707  continue;
708  }
709 
710  $threshold = (float) $reg[1];
711  if (!empty($object->total_ht) && $object->total_ht <= $threshold) {
712  dol_syslog("A notification is requested for notifcode = ".$notifcode." but amount = ".$object->total_ht." so lower than threshold = ".$threshold.". We discard this notification");
713  continue;
714  }
715 
716  $param = 'NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_'.$reg[1];
717 
718  $sendto = $conf->global->$param;
719  $notifcodedefid = dol_getIdFromCode($this->db, $notifcode, 'c_action_trigger', 'code', 'rowid');
720  if ($notifcodedefid <= 0) {
721  dol_print_error($this->db, 'Failed to get id from code');
722  }
723  $trackid = '';
724 
725  $object_type = '';
726  $link = '';
727  $num++;
728 
729  $subject = '['.$mysoc->name.'] '.$langs->transnoentitiesnoconv("DolibarrNotification").($projtitle ? ' '.$projtitle : '');
730 
731  switch ($notifcode) {
732  case 'BILL_VALIDATE':
733  $link = '<a href="'.$urlwithroot.'/compta/facture/card.php?facid='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
734  $dir_output = $conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice');
735  $object_type = 'facture';
736  $mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated", $link);
737  break;
738  case 'BILL_PAYED':
739  $link = '<a href="'.$urlwithroot.'/compta/facture/card.php?facid='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
740  $dir_output = $conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice');
741  $object_type = 'facture';
742  $mesg = $langs->transnoentitiesnoconv("EMailTextInvoicePayed", $link);
743  break;
744  case 'ORDER_VALIDATE':
745  $link = '<a href="'.$urlwithroot.'/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
746  $dir_output = $conf->commande->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'commande');
747  $object_type = 'order';
748  $mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated", $link);
749  break;
750  case 'PROPAL_VALIDATE':
751  $link = '<a href="'.$urlwithroot.'/comm/propal/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
752  $dir_output = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal');
753  $object_type = 'propal';
754  $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated", $link);
755  break;
756  case 'PROPAL_CLOSE_SIGNED':
757  $link = '<a href="'.$urlwithroot.'/comm/propal/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
758  $dir_output = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal');
759  $object_type = 'propal';
760  $mesg = $langs->transnoentitiesnoconv("EMailTextProposalClosedSigned", $link);
761  break;
762  case 'FICHINTER_ADD_CONTACT':
763  $link = '<a href="'.$urlwithroot.'/fichinter/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
764  $dir_output = $conf->ficheinter->dir_output;
765  $object_type = 'ficheinter';
766  $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionAddedContact", $link);
767  break;
768  case 'FICHINTER_VALIDATE':
769  $link = '<a href="'.$urlwithroot.'/fichinter/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
770  $dir_output = $conf->facture->dir_output;
771  $object_type = 'ficheinter';
772  $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated", $link);
773  break;
774  case 'ORDER_SUPPLIER_VALIDATE':
775  $link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
776  $dir_output = $conf->fournisseur->commande->dir_output;
777  $object_type = 'order_supplier';
778  $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
779  $mesg .= $langs->transnoentitiesnoconv("EMailTextOrderValidatedBy", $link, $user->getFullName($langs));
780  $mesg .= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
781  break;
782  case 'ORDER_SUPPLIER_APPROVE':
783  $link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
784  $dir_output = $conf->fournisseur->commande->dir_output;
785  $object_type = 'order_supplier';
786  $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
787  $mesg .= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $link, $user->getFullName($langs));
788  $mesg .= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
789  break;
790  case 'ORDER_SUPPLIER_APPROVE2':
791  $link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
792  $dir_output = $conf->fournisseur->commande->dir_output;
793  $object_type = 'order_supplier';
794  $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
795  $mesg .= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $link, $user->getFullName($langs));
796  $mesg .= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
797  break;
798  case 'ORDER_SUPPLIER_REFUSE':
799  $link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
800  $dir_output = $conf->fournisseur->dir_output.'/commande/';
801  $object_type = 'order_supplier';
802  $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
803  $mesg .= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy", $link, $user->getFullName($langs));
804  $mesg .= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
805  break;
806  case 'SHIPPING_VALIDATE':
807  $link = '<a href="'.$urlwithroot.'/expedition/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
808  $dir_output = $conf->expedition->dir_output."/sending/".get_exdir(0, 0, 0, 1, $object, 'shipment');
809  $object_type = 'order_supplier';
810  $mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated", $link);
811  break;
812  case 'EXPENSE_REPORT_VALIDATE':
813  $link = '<a href="'.$urlwithroot.'/expensereport/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
814  $dir_output = $conf->expensereport->dir_output;
815  $object_type = 'expensereport';
816  $mesg = $langs->transnoentitiesnoconv("EMailTextExpenseReportValidated", $link);
817  break;
818  case 'EXPENSE_REPORT_APPROVE':
819  $link = '<a href="'.$urlwithroot.'/expensereport/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
820  $dir_output = $conf->expensereport->dir_output;
821  $object_type = 'expensereport';
822  $mesg = $langs->transnoentitiesnoconv("EMailTextExpenseReportApproved", $link);
823  break;
824  case 'HOLIDAY_VALIDATE':
825  $link = '<a href="'.$urlwithroot.'/holiday/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
826  $dir_output = $conf->holiday->dir_output;
827  $object_type = 'holiday';
828  $mesg = $langs->transnoentitiesnoconv("EMailTextHolidayValidated", $link);
829  break;
830  case 'HOLIDAY_APPROVE':
831  $link = '<a href="'.$urlwithroot.'/holiday/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
832  $dir_output = $conf->holiday->dir_output;
833  $object_type = 'holiday';
834  $mesg = $langs->transnoentitiesnoconv("EMailTextHolidayApproved", $link);
835  break;
836  case 'ACTION_CREATE':
837  $link = '<a href="'.$urlwithroot.'/comm/action/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
838  $dir_output = $conf->agenda->dir_output;
839  $object_type = 'action';
840  $mesg = $langs->transnoentitiesnoconv("EMailTextActionAdded", $link);
841  break;
842  default:
843  $object_type = $object->element;
844  $dir_output = $conf->$object_type->multidir_output[$object->entity ? $object->entity : $conf->entity]."/".get_exdir(0, 0, 0, 1, $object, $object_type);
845  $mesg = $langs->transnoentitiesnoconv('Notify_'.$notifcode).' '.$newref;
846  break;
847  }
848  $ref = dol_sanitizeFileName($newref);
849  $pdf_path = $dir_output."/".$ref."/".$ref.".pdf";
850  if (!dol_is_file($pdf_path)) {
851  // We can't add PDF as it is not generated yet.
852  $filepdf = '';
853  } else {
854  $filepdf = $pdf_path;
855  $filename_list[] = $pdf_path;
856  $mimetype_list[] = mime_content_type($filepdf);
857  $mimefilename_list[] = $ref.".pdf";
858  }
859 
860  $message = '';
861  $message .= $langs->transnoentities("YouReceiveMailBecauseOfNotification2", $application, $mysoc->name)."\n";
862  $message .= "\n";
863  $message .= $mesg;
864 
865  $message = nl2br($message);
866 
867  // Replace keyword __SUPERVISOREMAIL__
868  if (preg_match('/__SUPERVISOREMAIL__/', $sendto)) {
869  $newval = '';
870  if ($user->fk_user > 0) {
871  $supervisoruser = new User($this->db);
872  $supervisoruser->fetch($user->fk_user);
873  if ($supervisoruser->email) {
874  $newval = trim(dolGetFirstLastname($supervisoruser->firstname, $supervisoruser->lastname).' <'.$supervisoruser->email.'>');
875  }
876  }
877  dol_syslog("Replace the __SUPERVISOREMAIL__ key into recipient email string with ".$newval);
878  $sendto = preg_replace('/__SUPERVISOREMAIL__/', $newval, $sendto);
879  $sendto = preg_replace('/,\s*,/', ',', $sendto); // in some case you can have $sendto like "email, __SUPERVISOREMAIL__ , otheremail" then you have "email, , othermail" and it's not valid
880  $sendto = preg_replace('/^[\s,]+/', '', $sendto); // Clean start of string
881  $sendto = preg_replace('/[\s,]+$/', '', $sendto); // Clean end of string
882  }
883 
884  if ($sendto) {
885  $parameters = array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list);
886  $reshook = $hookmanager->executeHooks('formatNotificationMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
887  if (empty($reshook)) {
888  if (!empty($hookmanager->resArray['files'])) {
889  $filename_list = $hookmanager->resArray['files']['file'];
890  $mimetype_list = $hookmanager->resArray['files']['mimefile'];
891  $mimefilename_list = $hookmanager->resArray['files']['filename'];
892  }
893  if (!empty($hookmanager->resArray['subject'])) {
894  $subject .= $hookmanager->resArray['subject'];
895  }
896  if (!empty($hookmanager->resArray['message'])) {
897  $message .= $hookmanager->resArray['message'];
898  }
899  }
900  $mailfile = new CMailFile(
901  $subject,
902  $sendto,
903  $replyto,
904  $message,
905  $filename_list,
906  $mimetype_list,
907  $mimefilename_list,
908  '',
909  '',
910  0,
911  1,
912  '',
913  $trackid,
914  '',
915  '',
916  'notification'
917  );
918 
919  if ($mailfile->sendfile()) {
920  $sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_contact, type, type_target, objet_type, objet_id, email)";
921  $sql .= " VALUES ('".$this->db->idate(dol_now())."', ".((int) $notifcodedefid).", ".($object->socid > 0 ? ((int) $object->socid) : 'null').", null, 'email', 'tofixedemail', '".$this->db->escape($object_type)."', ".((int) $object->id).", '".$this->db->escape($conf->global->$param)."')";
922  if (!$this->db->query($sql)) {
923  dol_print_error($this->db);
924  }
925  } else {
926  $error++;
927  $this->errors[] = $mailfile->error;
928  }
929  }
930  }
931  }
932 
933  if (!$error) {
934  return $num;
935  } else {
936  return -1 * $error;
937  }
938  }
939 }
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Classe permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new For...
Class to manage hooks.
Class to manage notifications.
confirmMessage($action, $socid, $object)
Return message that say how many notification (and to which email) will occurs on requested event.
getNotificationsArray($notifcode, $socid=0, $object=null, $userid=0, $scope=array('thirdparty', 'user', 'global'))
Return number of notifications activated for action code (and third party)
send($notifcode, $object, $filename_list=array(), $mimetype_list=array(), $mimefilename_list=array())
Check if notification are active for couple action/company.
__construct($db)
Constructor.
Class to manage projects.
Class to manage translations.
Class to manage Dolibarr users.
Definition: user.class.php:47
if(isModEnabled('facture') &&!empty($user->rights->facture->lire)) if((isModEnabled('fournisseur') &&empty($conf->global->MAIN_USE_NEW_SUPPLIERMOD) && $user->hasRight("fournisseur", "facture", "lire"))||(isModEnabled('supplier_invoice') && $user->hasRight("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->hasRight("commande", "lire") &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) $resql
Social contributions to pay.
Definition: index.php:745
dol_is_file($pathoffile)
Return if path is a file.
Definition: files.lib.php:481
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
dol_now($mode='auto')
Return date for now.
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null)
Return array of possible common substitutions.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
div float
Buy price without taxes.
Definition: style.css.php:913
$conf db
API class for accounts.
Definition: inc.php:41