dolibarr  16.0.5
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  $parameters = array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list, 'outputlangs'=>$outputlangs, 'labeltouse'=>$labeltouse);
629  if (!isset($action)) {
630  $action = '';
631  }
632 
633  $reshook = $hookmanager->executeHooks('formatNotificationMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
634  if (empty($reshook)) {
635  if (!empty($hookmanager->resArray['subject'])) {
636  $subject .= $hookmanager->resArray['subject'];
637  }
638  if (!empty($hookmanager->resArray['message'])) {
639  $message .= $hookmanager->resArray['message'];
640  }
641  }
642 
643  $mailfile = new CMailFile(
644  $subject,
645  $sendto,
646  $replyto,
647  $message,
648  $filename_list,
649  $mimetype_list,
650  $mimefilename_list,
651  '',
652  '',
653  0,
654  -1,
655  '',
656  '',
657  $trackid,
658  '',
659  'notification'
660  );
661 
662  if ($mailfile->sendfile()) {
663  if ($obj->type_target == 'touserid') {
664  $sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_user, type, objet_type, type_target, objet_id, email)";
665  $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)."')";
666  } else {
667  $sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_contact, type, objet_type, type_target, objet_id, email)";
668  $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)."')";
669  }
670  if (!$this->db->query($sql)) {
671  dol_print_error($this->db);
672  }
673  } else {
674  $error++;
675  $this->errors[] = $mailfile->error;
676  }
677  } else {
678  dol_syslog("No notification sent for ".$sendto." because email is empty");
679  }
680  $i++;
681  }
682  } else {
683  dol_syslog("No notification to thirdparty sent, nothing into notification setup for the thirdparty socid = ".(empty($object->socid) ? '' : $object->socid));
684  }
685  } else {
686  $error++;
687  $this->errors[] = $this->db->lasterror();
688  dol_syslog("Failed to get list of notification to send ".$this->db->lasterror(), LOG_ERR);
689  return -1;
690  }
691 
692  // Check notification using fixed email
693  if (!$error) {
694  foreach ($conf->global as $key => $val) {
695  $reg = array();
696  if ($val == '' || !preg_match('/^NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_(.*)$/', $key, $reg)) {
697  continue;
698  }
699 
700  $threshold = (float) $reg[1];
701  if (!empty($object->total_ht) && $object->total_ht <= $threshold) {
702  dol_syslog("A notification is requested for notifcode = ".$notifcode." but amount = ".$object->total_ht." so lower than threshold = ".$threshold.". We discard this notification");
703  continue;
704  }
705 
706  $param = 'NOTIFICATION_FIXEDEMAIL_'.$notifcode.'_THRESHOLD_HIGHER_'.$reg[1];
707 
708  $sendto = $conf->global->$param;
709  $notifcodedefid = dol_getIdFromCode($this->db, $notifcode, 'c_action_trigger', 'code', 'rowid');
710  if ($notifcodedefid <= 0) {
711  dol_print_error($this->db, 'Failed to get id from code');
712  }
713  $trackid = '';
714 
715  $object_type = '';
716  $link = '';
717  $num++;
718 
719  $subject = '['.$mysoc->name.'] '.$langs->transnoentitiesnoconv("DolibarrNotification").($projtitle ? ' '.$projtitle : '');
720 
721  switch ($notifcode) {
722  case 'BILL_VALIDATE':
723  $link = '<a href="'.$urlwithroot.'/compta/facture/card.php?facid='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
724  $dir_output = $conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice');
725  $object_type = 'facture';
726  $mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated", $link);
727  break;
728  case 'BILL_PAYED':
729  $link = '<a href="'.$urlwithroot.'/compta/facture/card.php?facid='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
730  $dir_output = $conf->facture->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'invoice');
731  $object_type = 'facture';
732  $mesg = $langs->transnoentitiesnoconv("EMailTextInvoicePayed", $link);
733  break;
734  case 'ORDER_VALIDATE':
735  $link = '<a href="'.$urlwithroot.'/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
736  $dir_output = $conf->commande->dir_output."/".get_exdir(0, 0, 0, 1, $object, 'commande');
737  $object_type = 'order';
738  $mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated", $link);
739  break;
740  case 'PROPAL_VALIDATE':
741  $link = '<a href="'.$urlwithroot.'/comm/propal/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
742  $dir_output = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal');
743  $object_type = 'propal';
744  $mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated", $link);
745  break;
746  case 'PROPAL_CLOSE_SIGNED':
747  $link = '<a href="'.$urlwithroot.'/comm/propal/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
748  $dir_output = $conf->propal->multidir_output[$object->entity]."/".get_exdir(0, 0, 0, 1, $object, 'propal');
749  $object_type = 'propal';
750  $mesg = $langs->transnoentitiesnoconv("EMailTextProposalClosedSigned", $link);
751  break;
752  case 'FICHINTER_ADD_CONTACT':
753  $link = '<a href="'.$urlwithroot.'/fichinter/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
754  $dir_output = $conf->ficheinter->dir_output;
755  $object_type = 'ficheinter';
756  $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionAddedContact", $link);
757  break;
758  case 'FICHINTER_VALIDATE':
759  $link = '<a href="'.$urlwithroot.'/fichinter/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
760  $dir_output = $conf->facture->dir_output;
761  $object_type = 'ficheinter';
762  $mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated", $link);
763  break;
764  case 'ORDER_SUPPLIER_VALIDATE':
765  $link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
766  $dir_output = $conf->fournisseur->commande->dir_output;
767  $object_type = 'order_supplier';
768  $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
769  $mesg .= $langs->transnoentitiesnoconv("EMailTextOrderValidatedBy", $link, $user->getFullName($langs));
770  $mesg .= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
771  break;
772  case 'ORDER_SUPPLIER_APPROVE':
773  $link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
774  $dir_output = $conf->fournisseur->commande->dir_output;
775  $object_type = 'order_supplier';
776  $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
777  $mesg .= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $link, $user->getFullName($langs));
778  $mesg .= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
779  break;
780  case 'ORDER_SUPPLIER_APPROVE2':
781  $link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
782  $dir_output = $conf->fournisseur->commande->dir_output;
783  $object_type = 'order_supplier';
784  $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
785  $mesg .= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $link, $user->getFullName($langs));
786  $mesg .= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
787  break;
788  case 'ORDER_SUPPLIER_REFUSE':
789  $link = '<a href="'.$urlwithroot.'/fourn/commande/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
790  $dir_output = $conf->fournisseur->dir_output.'/commande/';
791  $object_type = 'order_supplier';
792  $mesg = $langs->transnoentitiesnoconv("Hello").",\n\n";
793  $mesg .= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy", $link, $user->getFullName($langs));
794  $mesg .= "\n\n".$langs->transnoentitiesnoconv("Sincerely").".\n\n";
795  break;
796  case 'SHIPPING_VALIDATE':
797  $link = '<a href="'.$urlwithroot.'/expedition/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
798  $dir_output = $conf->expedition->dir_output."/sending/".get_exdir(0, 0, 0, 1, $object, 'shipment');
799  $object_type = 'order_supplier';
800  $mesg = $langs->transnoentitiesnoconv("EMailTextExpeditionValidated", $link);
801  break;
802  case 'EXPENSE_REPORT_VALIDATE':
803  $link = '<a href="'.$urlwithroot.'/expensereport/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
804  $dir_output = $conf->expensereport->dir_output;
805  $object_type = 'expensereport';
806  $mesg = $langs->transnoentitiesnoconv("EMailTextExpenseReportValidated", $link);
807  break;
808  case 'EXPENSE_REPORT_APPROVE':
809  $link = '<a href="'.$urlwithroot.'/expensereport/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
810  $dir_output = $conf->expensereport->dir_output;
811  $object_type = 'expensereport';
812  $mesg = $langs->transnoentitiesnoconv("EMailTextExpenseReportApproved", $link);
813  break;
814  case 'HOLIDAY_VALIDATE':
815  $link = '<a href="'.$urlwithroot.'/holiday/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
816  $dir_output = $conf->holiday->dir_output;
817  $object_type = 'holiday';
818  $mesg = $langs->transnoentitiesnoconv("EMailTextHolidayValidated", $link);
819  break;
820  case 'HOLIDAY_APPROVE':
821  $link = '<a href="'.$urlwithroot.'/holiday/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
822  $dir_output = $conf->holiday->dir_output;
823  $object_type = 'holiday';
824  $mesg = $langs->transnoentitiesnoconv("EMailTextHolidayApproved", $link);
825  break;
826  case 'ACTION_CREATE':
827  $link = '<a href="'.$urlwithroot.'/comm/action/card.php?id='.$object->id.'&entity='.$object->entity.'">'.$newref.'</a>';
828  $dir_output = $conf->agenda->dir_output;
829  $object_type = 'action';
830  $mesg = $langs->transnoentitiesnoconv("EMailTextActionAdded", $link);
831  break;
832  default:
833  $object_type = $object->element;
834  $dir_output = $conf->$object_type->multidir_output[$object->entity ? $object->entity : $conf->entity]."/".get_exdir(0, 0, 0, 1, $object, $object_type);
835  $mesg = $langs->transnoentitiesnoconv('Notify_'.$notifcode).' '.$newref;
836  break;
837  }
838  $ref = dol_sanitizeFileName($newref);
839  $pdf_path = $dir_output."/".$ref."/".$ref.".pdf";
840  if (!dol_is_file($pdf_path)) {
841  // We can't add PDF as it is not generated yet.
842  $filepdf = '';
843  } else {
844  $filepdf = $pdf_path;
845  $filename_list[] = $pdf_path;
846  $mimetype_list[] = mime_content_type($filepdf);
847  $mimefilename_list[] = $ref.".pdf";
848  }
849 
850  $message = '';
851  $message .= $langs->transnoentities("YouReceiveMailBecauseOfNotification2", $application, $mysoc->name)."\n";
852  $message .= "\n";
853  $message .= $mesg;
854 
855  $message = nl2br($message);
856 
857  // Replace keyword __SUPERVISOREMAIL__
858  if (preg_match('/__SUPERVISOREMAIL__/', $sendto)) {
859  $newval = '';
860  if ($user->fk_user > 0) {
861  $supervisoruser = new User($this->db);
862  $supervisoruser->fetch($user->fk_user);
863  if ($supervisoruser->email) {
864  $newval = trim(dolGetFirstLastname($supervisoruser->firstname, $supervisoruser->lastname).' <'.$supervisoruser->email.'>');
865  }
866  }
867  dol_syslog("Replace the __SUPERVISOREMAIL__ key into recipient email string with ".$newval);
868  $sendto = preg_replace('/__SUPERVISOREMAIL__/', $newval, $sendto);
869  $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
870  $sendto = preg_replace('/^[\s,]+/', '', $sendto); // Clean start of string
871  $sendto = preg_replace('/[\s,]+$/', '', $sendto); // Clean end of string
872  }
873 
874  if ($sendto) {
875  $parameters = array('notifcode'=>$notifcode, 'sendto'=>$sendto, 'replyto'=>$replyto, 'file'=>$filename_list, 'mimefile'=>$mimetype_list, 'filename'=>$mimefilename_list);
876  $reshook = $hookmanager->executeHooks('formatNotificationMessage', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
877  if (empty($reshook)) {
878  if (!empty($hookmanager->resArray['subject'])) {
879  $subject .= $hookmanager->resArray['subject'];
880  }
881  if (!empty($hookmanager->resArray['message'])) {
882  $message .= $hookmanager->resArray['message'];
883  }
884  }
885  $mailfile = new CMailFile(
886  $subject,
887  $sendto,
888  $replyto,
889  $message,
890  $filename_list,
891  $mimetype_list,
892  $mimefilename_list,
893  '',
894  '',
895  0,
896  1,
897  '',
898  $trackid,
899  '',
900  '',
901  'notification'
902  );
903 
904  if ($mailfile->sendfile()) {
905  $sql = "INSERT INTO ".$this->db->prefix()."notify (daten, fk_action, fk_soc, fk_contact, type, type_target, objet_type, objet_id, email)";
906  $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)."')";
907  if (!$this->db->query($sql)) {
908  dol_print_error($this->db);
909  }
910  } else {
911  $error++;
912  $this->errors[] = $mailfile->error;
913  }
914  }
915  }
916  }
917 
918  if (!$error) {
919  return $num;
920  } else {
921  return -1 * $error;
922  }
923  }
924 }
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:7839
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:1226
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:4844
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:38
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:477
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:6549
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:8535
isValidEmail
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
Definition: functions.lib.php:3681
getCommonSubstitutionArray
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null)
Return array of possible common substitutions.
Definition: functions.lib.php:7275
dol_syslog
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
Definition: functions.lib.php:1603
dol_strlen
dol_strlen($string, $stringencoding='UTF-8')
Make a strlen call.
Definition: functions.lib.php:3747
dolGetFirstLastname
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
Definition: functions.lib.php:8062
User
Class to manage Dolibarr users.
Definition: user.class.php:44
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:4211
dol_now
dol_now($mode='auto')
Return date for now.
Definition: functions.lib.php:2845
$resql
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.
Definition: index.php:742
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:7961
float
div float
Buy price without taxes.
Definition: style.css.php:809