dolibarr  17.0.3
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  $mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n";
529  $mesg .= $outputlangs->transnoentitiesnoconv("EMailTextOrderValidatedBy", $link, $user->getFullName($outputlangs));
530  $mesg .= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n";
531  break;
532  case 'ORDER_SUPPLIER_APPROVE':
533  $link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
534  $dir_output = $conf->fournisseur->commande->dir_output;
535  $object_type = 'order_supplier';
536  $mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n";
537  $mesg .= $outputlangs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $link, $user->getFullName($outputlangs));
538  $mesg .= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n";
539  break;
540  case 'ORDER_SUPPLIER_REFUSE':
541  $link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
542  $dir_output = $conf->fournisseur->commande->dir_output;
543  $object_type = 'order_supplier';
544  $mesg = $outputlangs->transnoentitiesnoconv("Hello").",\n\n";
545  $mesg .= $outputlangs->transnoentitiesnoconv("EMailTextOrderRefusedBy", $link, $user->getFullName($outputlangs));
546  $mesg .= "\n\n".$outputlangs->transnoentitiesnoconv("Sincerely").".\n\n";
547  break;
548  case 'SHIPPING_VALIDATE':
549  $link = '<a href="'.$urlwithroot.'/expedition/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
550  $dir_output = $conf->expedition->dir_output."/sending/".get_exdir(0, 0, 0, 1, $object, 'shipment');
551  $object_type = 'shipping';
552  $labeltouse = $conf->global->SHIPPING_VALIDATE_TEMPLATE;
553  $mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpeditionValidated", $link);
554  break;
555  case 'EXPENSE_REPORT_VALIDATE':
556  $link = '<a href="'.$urlwithroot.'/expensereport/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
557  $dir_output = $conf->expensereport->dir_output;
558  $object_type = 'expensereport';
559  $labeltouse = $conf->global->EXPENSE_REPORT_VALIDATE_TEMPLATE;
560  $mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpenseReportValidated", $link);
561  break;
562  case 'EXPENSE_REPORT_APPROVE':
563  $link = '<a href="'.$urlwithroot.'/expensereport/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
564  $dir_output = $conf->expensereport->dir_output;
565  $object_type = 'expensereport';
566  $labeltouse = $conf->global->EXPENSE_REPORT_APPROVE_TEMPLATE;
567  $mesg = $outputlangs->transnoentitiesnoconv("EMailTextExpenseReportApproved", $link);
568  break;
569  case 'HOLIDAY_VALIDATE':
570  $link = '<a href="'.$urlwithroot.'/holiday/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
571  $dir_output = $conf->holiday->dir_output;
572  $object_type = 'holiday';
573  $labeltouse = $conf->global->HOLIDAY_VALIDATE_TEMPLATE;
574  $mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayValidated", $link);
575  break;
576  case 'HOLIDAY_APPROVE':
577  $link = '<a href="'.$urlwithroot.'/holiday/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
578  $dir_output = $conf->holiday->dir_output;
579  $object_type = 'holiday';
580  $labeltouse = $conf->global->HOLIDAY_APPROVE_TEMPLATE;
581  $mesg = $outputlangs->transnoentitiesnoconv("EMailTextHolidayApproved", $link);
582  break;
583  case 'ACTION_CREATE':
584  $link = '<a href="'.$urlwithroot.'/comm/action/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
585  $dir_output = $conf->agenda->dir_output;
586  $object_type = 'action';
587  $labeltouse = $conf->global->ACTION_CREATE_TEMPLATE;
588  $mesg = $outputlangs->transnoentitiesnoconv("EMailTextActionAdded", $link);
589  break;
590  default:
591  $object_type = $object->element;
592  $dir_output = $conf->$object_type->multidir_output[$object->entity ? $object->entity : $conf->entity]."/".get_exdir(0, 0, 0, 1, $object, $object_type);
593  $template = $notifcode.'_TEMPLATE';
594  $labeltouse = $conf->global->$template;
595  $mesg = $outputlangs->transnoentitiesnoconv('Notify_'.$notifcode).' '.$newref.' '.$dir_output;
596  break;
597  }
598 
599  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
600  $formmail = new FormMail($this->db);
601  $arraydefaultmessage = null;
602 
603  if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($this->db, $object_type.'_send', $user, $outputlangs, 0, 1, $labeltouse);
604  if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) {
605  $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
606  complete_substitutions_array($substitutionarray, $outputlangs, $object);
607  $subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs);
608  $message = make_substitutions($arraydefaultmessage->content, $substitutionarray, $outputlangs);
609  } else {
610  $message = $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification", $application, $mysoc->name)."\n";
611  $message .= $outputlangs->transnoentities("YouReceiveMailBecauseOfNotification2", $application, $mysoc->name)."\n";
612  $message .= "\n";
613  $message .= $mesg;
614  }
615 
616  $ref = dol_sanitizeFileName($newref);
617  $pdf_path = $dir_output."/".$ref.".pdf";
618  if (!dol_is_file($pdf_path)||(is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0 && !$arraydefaultmessage->joinfiles)) {
619  // We can't add PDF as it is not generated yet.
620  $filepdf = '';
621  } else {
622  $filepdf = $pdf_path;
623  $filename_list[] = $filepdf;
624  $mimetype_list[] = mime_content_type($filepdf);
625  $mimefilename_list[] = $ref.".pdf";
626  }
627 
628  $labeltouse = !empty($labeltouse) ? $labeltouse : '';
629 
630  $parameters = array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list, 'outputlangs'=>$outputlangs, 'labeltouse'=>$labeltouse);
631  if (!isset($action)) {
632  $action = '';
633  }
634 
635  $reshook = $hookmanager->executeHooks('formatNotificationMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
636  if (empty($reshook)) {
637  if (!empty($hookmanager->resArray['files'])) {
638  $filename_list = $hookmanager->resArray['files']['file'];
639  $mimetype_list = $hookmanager->resArray['files']['mimefile'];
640  $mimefilename_list = $hookmanager->resArray['files']['filename'];
641  }
642  if (!empty($hookmanager->resArray['subject'])) {
643  $subject .= $hookmanager->resArray['subject'];
644  }
645  if (!empty($hookmanager->resArray['message'])) {
646  $message .= $hookmanager->resArray['message'];
647  }
648  }
649 
650  $mailfile = new CMailFile(
651  $subject,
652  $sendto,
653  $replyto,
654  $message,
655  $filename_list,
656  $mimetype_list,
657  $mimefilename_list,
658  '',
659  '',
660  0,
661  -1,
662  '',
663  '',
664  $trackid,
665  '',
666  'notification'
667  );
668 
669  if ($mailfile->sendfile()) {
670  if ($obj->type_target == 'touserid') {
671  $sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_user, type, objet_type, type_target, objet_id, email)";
672  $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)."')";
673  } else {
674  $sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_contact, 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  }
677  if (!$this->db->query($sql)) {
678  dol_print_error($this->db);
679  }
680  } else {
681  $error++;
682  $this->errors[] = $mailfile->error;
683  }
684  } else {
685  dol_syslog("No notification sent for ".$sendto." because email is empty");
686  }
687  $i++;
688  }
689  } else {
690  dol_syslog("No notification to thirdparty sent, nothing into notification setup for the thirdparty socid = ".(empty($object->socid) ? '' : $object->socid));
691  }
692  } else {
693  $error++;
694  $this->errors[] = $this->db->lasterror();
695  dol_syslog("Failed to get list of notification to send ".$this->db->lasterror(), LOG_ERR);
696  return -1;
697  }
698 
699  // Check notification using fixed email
700  if (!$error) {
701  foreach ($conf->global as $key => $val) {
702  $reg = array();
703  if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) {
704  continue;
705  }
706 
707  $threshold = (float) $reg[1];
708  if (!empty($object->total_ht) && $object->total_ht <= $threshold) {
709  dol_syslog("A notification is requested for notifcode = ".$notifcode." but amount = ".$object->total_ht." so lower than threshold = ".$threshold.". We discard this notification");
710  continue;
711  }
712 
713  $param = 'NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_'.$reg[1];
714 
715  $sendto = $conf->global->$param;
716  $notifcodedefid = dol_getIdFromCode($this->db, $notifcode, 'c_action_trigger', 'code', 'rowid');
717  if ($notifcodedefid <= 0) {
718  dol_print_error($this->db, 'Failed to get id from code');
719  }
720  $trackid = '';
721 
722  $object_type = '';
723  $link = '';
724  $num++;
725 
726  $subject = '['.$mysoc->name.'] '.$langs->transnoentitiesnoconv("DolibarrNotification").($projtitle ? ' '.$projtitle : '');
727 
728  switch ($notifcode) {
729  case 'BILL_VALIDATE':
730  $link = '<a href="'.$urlwithroot.'/compta/facture/card.php?facid='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
731  $dir_output = $conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice');
732  $object_type = 'facture';
733  $mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated", $link);
734  break;
735  case 'BILL_PAYED':
736  $link = '<a href="'.$urlwithroot.'/compta/facture/card.php?facid='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
737  $dir_output = $conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice');
738  $object_type = 'facture';
739  $mesg = $langs->transnoentitiesnoconv("EMailTextInvoicePayed", $link);
740  break;
741  case 'ORDER_VALIDATE':
742  $link = '<a href="'.$urlwithroot.'/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
743  $dir_output = $conf->commande->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'commande');
744  $object_type = 'order';
745  $mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated", $link);
746  break;
747  case 'PROPAL_VALIDATE':
748  $link = '<a href="'.$urlwithroot.'/comm/propal/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
749  $dir_output = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal');
750  $object_type = 'propal';
751  $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated", $link);
752  break;
753  case 'PROPAL_CLOSE_SIGNED':
754  $link = '<a href="'.$urlwithroot.'/comm/propal/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
755  $dir_output = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal');
756  $object_type = 'propal';
757  $mesg = $langs->transnoentitiesnoconv("EMailTextProposalClosedSigned", $link);
758  break;
759  case 'FICHINTER_ADD_CONTACT':
760  $link = '<a href="'.$urlwithroot.'/fichinter/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
761  $dir_output = $conf->ficheinter->dir_output;
762  $object_type = 'ficheinter';
763  $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionAddedContact", $link);
764  break;
765  case 'FICHINTER_VALIDATE':
766  $link = '<a href="'.$urlwithroot.'/fichinter/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
767  $dir_output = $conf->facture->dir_output;
768  $object_type = 'ficheinter';
769  $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated", $link);
770  break;
771  case 'ORDER_SUPPLIER_VALIDATE':
772  $link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
773  $dir_output = $conf->fournisseur->commande->dir_output;
774  $object_type = 'order_supplier';
775  $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
776  $mesg .= $langs->transnoentitiesnoconv("EMailTextOrderValidatedBy", $link, $user->getFullName($langs));
777  $mesg .= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
778  break;
779  case 'ORDER_SUPPLIER_APPROVE':
780  $link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
781  $dir_output = $conf->fournisseur->commande->dir_output;
782  $object_type = 'order_supplier';
783  $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
784  $mesg .= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $link, $user->getFullName($langs));
785  $mesg .= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
786  break;
787  case 'ORDER_SUPPLIER_APPROVE2':
788  $link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
789  $dir_output = $conf->fournisseur->commande->dir_output;
790  $object_type = 'order_supplier';
791  $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
792  $mesg .= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $link, $user->getFullName($langs));
793  $mesg .= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
794  break;
795  case 'ORDER_SUPPLIER_REFUSE':
796  $link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
797  $dir_output = $conf->fournisseur->dir_output.'/commande/';
798  $object_type = 'order_supplier';
799  $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
800  $mesg .= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy", $link, $user->getFullName($langs));
801  $mesg .= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
802  break;
803  case 'SHIPPING_VALIDATE':
804  $link = '<a href="'.$urlwithroot.'/expedition/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
805  $dir_output = $conf->expedition->dir_output."/sending/".get_exdir(0, 0, 0, 1, $object, 'shipment');
806  $object_type = 'order_supplier';
807  $mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated", $link);
808  break;
809  case 'EXPENSE_REPORT_VALIDATE':
810  $link = '<a href="'.$urlwithroot.'/expensereport/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
811  $dir_output = $conf->expensereport->dir_output;
812  $object_type = 'expensereport';
813  $mesg = $langs->transnoentitiesnoconv("EMailTextExpenseReportValidated", $link);
814  break;
815  case 'EXPENSE_REPORT_APPROVE':
816  $link = '<a href="'.$urlwithroot.'/expensereport/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
817  $dir_output = $conf->expensereport->dir_output;
818  $object_type = 'expensereport';
819  $mesg = $langs->transnoentitiesnoconv("EMailTextExpenseReportApproved", $link);
820  break;
821  case 'HOLIDAY_VALIDATE':
822  $link = '<a href="'.$urlwithroot.'/holiday/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
823  $dir_output = $conf->holiday->dir_output;
824  $object_type = 'holiday';
825  $mesg = $langs->transnoentitiesnoconv("EMailTextHolidayValidated", $link);
826  break;
827  case 'HOLIDAY_APPROVE':
828  $link = '<a href="'.$urlwithroot.'/holiday/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
829  $dir_output = $conf->holiday->dir_output;
830  $object_type = 'holiday';
831  $mesg = $langs->transnoentitiesnoconv("EMailTextHolidayApproved", $link);
832  break;
833  case 'ACTION_CREATE':
834  $link = '<a href="'.$urlwithroot.'/comm/action/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
835  $dir_output = $conf->agenda->dir_output;
836  $object_type = 'action';
837  $mesg = $langs->transnoentitiesnoconv("EMailTextActionAdded", $link);
838  break;
839  default:
840  $object_type = $object->element;
841  $dir_output = $conf->$object_type->multidir_output[$object->entity ? $object->entity : $conf->entity]."/".get_exdir(0, 0, 0, 1, $object, $object_type);
842  $mesg = $langs->transnoentitiesnoconv('Notify_'.$notifcode).' '.$newref;
843  break;
844  }
845  $ref = dol_sanitizeFileName($newref);
846  $pdf_path = $dir_output."/".$ref."/".$ref.".pdf";
847  if (!dol_is_file($pdf_path)) {
848  // We can't add PDF as it is not generated yet.
849  $filepdf = '';
850  } else {
851  $filepdf = $pdf_path;
852  $filename_list[] = $pdf_path;
853  $mimetype_list[] = mime_content_type($filepdf);
854  $mimefilename_list[] = $ref.".pdf";
855  }
856 
857  $message = '';
858  $message .= $langs->transnoentities("YouReceiveMailBecauseOfNotification2", $application, $mysoc->name)."\n";
859  $message .= "\n";
860  $message .= $mesg;
861 
862  $message = nl2br($message);
863 
864  // Replace keyword __SUPERVISOREMAIL__
865  if (preg_match('/__SUPERVISOREMAIL__/', $sendto)) {
866  $newval = '';
867  if ($user->fk_user > 0) {
868  $supervisoruser = new User($this->db);
869  $supervisoruser->fetch($user->fk_user);
870  if ($supervisoruser->email) {
871  $newval = trim(dolGetFirstLastname($supervisoruser->firstname, $supervisoruser->lastname).' <'.$supervisoruser->email.'>');
872  }
873  }
874  dol_syslog("Replace the __SUPERVISOREMAIL__ key into recipient email string with ".$newval);
875  $sendto = preg_replace('/__SUPERVISOREMAIL__/', $newval, $sendto);
876  $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
877  $sendto = preg_replace('/^[\s,]+/', '', $sendto); // Clean start of string
878  $sendto = preg_replace('/[\s,]+$/', '', $sendto); // Clean end of string
879  }
880 
881  if ($sendto) {
882  $parameters = array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list);
883  $reshook = $hookmanager->executeHooks('formatNotificationMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
884  if (empty($reshook)) {
885  if (!empty($hookmanager->resArray['files'])) {
886  $filename_list = $hookmanager->resArray['files']['file'];
887  $mimetype_list = $hookmanager->resArray['files']['mimefile'];
888  $mimefilename_list = $hookmanager->resArray['files']['filename'];
889  }
890  if (!empty($hookmanager->resArray['subject'])) {
891  $subject .= $hookmanager->resArray['subject'];
892  }
893  if (!empty($hookmanager->resArray['message'])) {
894  $message .= $hookmanager->resArray['message'];
895  }
896  }
897  $mailfile = new CMailFile(
898  $subject,
899  $sendto,
900  $replyto,
901  $message,
902  $filename_list,
903  $mimetype_list,
904  $mimefilename_list,
905  '',
906  '',
907  0,
908  1,
909  '',
910  $trackid,
911  '',
912  '',
913  'notification'
914  );
915 
916  if ($mailfile->sendfile()) {
917  $sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_contact, type, type_target, objet_type, objet_id, email)";
918  $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)."')";
919  if (!$this->db->query($sql)) {
920  dol_print_error($this->db);
921  }
922  } else {
923  $error++;
924  $this->errors[] = $mailfile->error;
925  }
926  }
927  }
928  }
929 
930  if (!$error) {
931  return $num;
932  } else {
933  return -1 * $error;
934  }
935  }
936 }
make_substitutions
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
Definition: functions.lib.php:8166
db
$conf db
API class for accounts.
Definition: inc.php:41
dol_sanitizeFileName
dol_sanitizeFileName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a file name.
Definition: functions.lib.php:1225
Project
Class to manage projects.
Definition: project.class.php:35
Notify\confirmMessage
confirmMessage($action, $socid, $object)
Return message that say how many notification (and to which email) will occurs on requested event.
Definition: notify.class.php:107
dol_print_error
dol_print_error($db='', $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
Definition: functions.lib.php:4993
Translate
Class to manage translations.
Definition: translate.class.php:30
Notify\getNotificationsArray
getNotificationsArray($notifcode, $socid=0, $object=null, $userid=0, $scope=array('thirdparty', 'user', 'global'))
Return number of notifications activated for action code (and third party)
Definition: notify.class.php:188
CMailFile
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Definition: CMailFile.class.php:41
Notify\send
send($notifcode, $object, $filename_list=array(), $mimetype_list=array(), $mimefilename_list=array())
Check if notification are active for couple action/company.
Definition: notify.class.php:352
Notify
Class to manage notifications.
Definition: notify.class.php:33
dol_is_file
dol_is_file($pathoffile)
Return if path is a file.
Definition: files.lib.php:481
get_exdir
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
Definition: functions.lib.php:6735
dol_getIdFromCode
dol_getIdFromCode($db, $key, $tablename, $fieldkey='code', $fieldid='id', $entityfilter=0, $filters='')
Return an id or code from a code or id.
Definition: functions.lib.php:8879
$resql
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
isValidEmail
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
Definition: functions.lib.php:3798
getCommonSubstitutionArray
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null)
Return array of possible common substitutions.
Definition: functions.lib.php:7569
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1628
dol_strlen
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
Definition: functions.lib.php:3887
dolGetFirstLastname
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
Definition: functions.lib.php:8390
User
Class to manage Dolibarr users.
Definition: user.class.php:46
img_object
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0)
Show a picto called object_picto (generic function)
Definition: functions.lib.php:4360
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2951
Notify\__construct
__construct($db)
Constructor.
Definition: notify.class.php:92
FormMail
Classe permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new For...
Definition: html.formmail.class.php:38
HookManager
Class to manage hooks.
Definition: hookmanager.class.php:30
complete_substitutions_array
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...
Definition: functions.lib.php:8289
float
div float
Buy price without taxes.
Definition: style.css.php:913