dolibarr  16.0.5
actions_sendmails.inc.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2013 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 * or see https://www.gnu.org/
18 */
19 
25 // $mysoc must be defined
26 // $id must be defined
27 // $paramname may be defined
28 // $autocopy may be defined (used to know the automatic BCC to add)
29 // $triggersendname must be set (can be '')
30 // $actiontypecode can be set
31 // $object and $uobject may be defined
32 
33 /*
34  * Add file in email form
35  */
36 if (GETPOST('addfile', 'alpha')) {
37  $trackid = GETPOST('trackid', 'aZ09');
38 
39  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
40 
41  // Set tmp user directory
42  $vardir = $conf->user->dir_output."/".$user->id;
43  $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path
44 
45  dol_add_file_process($upload_dir_tmp, 1, 0, 'addedfile', '', null, $trackid, 0);
46  $action = 'presend';
47 }
48 
49 /*
50  * Remove file in email form
51  */
52 if (GETPOST('removedfile') && !GETPOST('removAll')) {
53  $trackid = GETPOST('trackid', 'aZ09');
54 
55  require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
56 
57  // Set tmp user directory
58  $vardir = $conf->user->dir_output."/".$user->id;
59  $upload_dir_tmp = $vardir.'/temp'; // TODO Add $keytoavoidconflict in upload_dir path
60 
61  // TODO Delete only files that was uploaded from email form. This can be addressed by adding the trackid into the temp path then changing donotdeletefile to 2 instead of 1 to say "delete only if into temp dir"
62  // GETPOST('removedfile','alpha') is position of file into $_SESSION["listofpaths"...] array.
63  dol_remove_file_process(GETPOST('removedfile', 'alpha'), 0, 1, $trackid); // We do not delete because if file is the official PDF of doc, we don't want to remove it physically
64  $action = 'presend';
65 }
66 
67 /*
68  * Remove all files in email form
69  */
70 if (GETPOST('removAll', 'alpha')) {
71  $trackid = GETPOST('trackid', 'aZ09');
72 
73  $listofpaths = array();
74  $listofnames = array();
75  $listofmimes = array();
76  $keytoavoidconflict = empty($trackid) ? '' : '-'.$trackid;
77  if (!empty($_SESSION["listofpaths".$keytoavoidconflict])) {
78  $listofpaths = explode(';', $_SESSION["listofpaths".$keytoavoidconflict]);
79  }
80  if (!empty($_SESSION["listofnames".$keytoavoidconflict])) {
81  $listofnames = explode(';', $_SESSION["listofnames".$keytoavoidconflict]);
82  }
83  if (!empty($_SESSION["listofmimes".$keytoavoidconflict])) {
84  $listofmimes = explode(';', $_SESSION["listofmimes".$keytoavoidconflict]);
85  }
86 
87  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
88  $formmail = new FormMail($db);
89  $formmail->trackid = $trackid;
90 
91  foreach ($listofpaths as $key => $value) {
92  $pathtodelete = $value;
93  $filetodelete = $listofnames[$key];
94  $result = dol_delete_file($pathtodelete, 1); // Delete uploded Files
95 
96  $langs->load("other");
97  setEventMessages($langs->trans("FileWasRemoved", $filetodelete), null, 'mesgs');
98 
99  $formmail->remove_attached_files($key); // Update Session
100  }
101 }
102 
103 /*
104  * Send mail
105  */
106 if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPOST('removAll') && !GETPOST('removedfile') && !GETPOST('cancel') && !GETPOST('modelselected')) {
107  if (empty($trackid)) {
108  $trackid = GETPOST('trackid', 'aZ09');
109  }
110 
111  $subject = '';
112  //$actionmsg = '';
113  $actionmsg2 = '';
114 
115  $langs->load('mails');
116 
117  if (is_object($object)) {
118  $result = $object->fetch($id);
119 
120  $sendtosocid = 0; // Id of related thirdparty
121  if (method_exists($object, "fetch_thirdparty") && !in_array($object->element, array('member', 'user', 'expensereport', 'societe', 'contact'))) {
122  $resultthirdparty = $object->fetch_thirdparty();
123  $thirdparty = $object->thirdparty;
124  if (is_object($thirdparty)) {
125  $sendtosocid = $thirdparty->id;
126  }
127  } elseif ($object->element == 'member' || $object->element == 'user') {
128  $thirdparty = $object;
129  if ($object->socid > 0) {
130  $sendtosocid = $object->socid;
131  }
132  } elseif ($object->element == 'expensereport') {
133  $tmpuser = new User($db);
134  $tmpuser->fetch($object->fk_user_author);
135  $thirdparty = $tmpuser;
136  if ($object->socid > 0) {
137  $sendtosocid = $object->socid;
138  }
139  } elseif ($object->element == 'societe') {
140  $thirdparty = $object;
141  if (is_object($thirdparty) && $thirdparty->id > 0) {
142  $sendtosocid = $thirdparty->id;
143  }
144  } elseif ($object->element == 'contact') {
145  $contact = $object;
146  if ($contact->id > 0) {
147  $contact->fetch_thirdparty();
148  $thirdparty = $contact->thirdparty;
149  if (is_object($thirdparty) && $thirdparty->id > 0) {
150  $sendtosocid = $thirdparty->id;
151  }
152  }
153  } else {
154  dol_print_error('', "Use actions_sendmails.in.php for an element/object '".$object->element."' that is not supported");
155  }
156 
157  if (is_object($hookmanager)) {
158  $parameters = array();
159  $reshook = $hookmanager->executeHooks('initSendToSocid', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
160  }
161  } else {
162  $thirdparty = $mysoc;
163  }
164 
165  if ($result > 0) {
166  $sendto = '';
167  $sendtocc = '';
168  $sendtobcc = '';
169  $sendtoid = array();
170  $sendtouserid = array();
171  $sendtoccuserid = array();
172 
173  // Define $sendto
174  $receiver = GETPOST('receiver', 'alphawithlgt');
175  if (!is_array($receiver)) {
176  if ($receiver == '-1') {
177  $receiver = array();
178  } else {
179  $receiver = array($receiver);
180  }
181  }
182 
183  $tmparray = array();
184  if (trim($_POST['sendto'])) {
185  // Recipients are provided into free text field
186  $tmparray[] = trim(GETPOST('sendto', 'alphawithlgt'));
187  }
188 
189  if (trim($_POST['tomail'])) {
190  // Recipients are provided into free hidden text field
191  $tmparray[] = trim(GETPOST('tomail', 'alphawithlgt'));
192  }
193 
194  if (count($receiver) > 0) {
195  // Recipient was provided from combo list
196  foreach ($receiver as $key => $val) {
197  if ($val == 'thirdparty') { // Key selected means current third party ('thirdparty' may be used for current member or current user too)
198  $tmparray[] = dol_string_nospecial($thirdparty->getFullName($langs), ' ', array(",")).' <'.$thirdparty->email.'>';
199  } elseif ($val == 'contact') { // Key selected means current contact
200  $tmparray[] = dol_string_nospecial($contact->getFullName($langs), ' ', array(",")).' <'.$contact->email.'>';
201  $sendtoid[] = $contact->id;
202  } elseif ($val) { // $val is the Id of a contact
203  $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email');
204  $sendtoid[] = ((int) $val);
205  }
206  }
207  }
208 
209  if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
210  $receiveruser = GETPOST('receiveruser', 'alphawithlgt');
211  if (is_array($receiveruser) && count($receiveruser) > 0) {
212  $fuserdest = new User($db);
213  foreach ($receiveruser as $key => $val) {
214  $tmparray[] = $fuserdest->user_get_property($val, 'email');
215  $sendtouserid[] = $val;
216  }
217  }
218  }
219 
220  $sendto = implode(',', $tmparray);
221 
222  // Define $sendtocc
223  $receivercc = GETPOST('receivercc', 'alphawithlgt');
224  if (!is_array($receivercc)) {
225  if ($receivercc == '-1') {
226  $receivercc = array();
227  } else {
228  $receivercc = array($receivercc);
229  }
230  }
231  $tmparray = array();
232  if (trim($_POST['sendtocc'])) {
233  $tmparray[] = trim(GETPOST('sendtocc', 'alphawithlgt'));
234  }
235  if (count($receivercc) > 0) {
236  foreach ($receivercc as $key => $val) {
237  if ($val == 'thirdparty') { // Key selected means current thirdparty (may be usd for current member or current user too)
238  // Recipient was provided from combo list
239  $tmparray[] = dol_string_nospecial($thirdparty->name, ' ', array(",")).' <'.$thirdparty->email.'>';
240  } elseif ($val == 'contact') { // Key selected means current contact
241  // Recipient was provided from combo list
242  $tmparray[] = dol_string_nospecial($contact->name, ' ', array(",")).' <'.$contact->email.'>';
243  //$sendtoid[] = $contact->id; TODO Add also id of contact in CC ?
244  } elseif ($val) { // $val is the Id of a contact
245  $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email');
246  //$sendtoid[] = ((int) $val); TODO Add also id of contact in CC ?
247  }
248  }
249  }
250  if (!empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
251  $receiverccuser = GETPOST('receiverccuser', 'alphawithlgt');
252 
253  if (is_array($receiverccuser) && count($receiverccuser) > 0) {
254  $fuserdest = new User($db);
255  foreach ($receiverccuser as $key => $val) {
256  $tmparray[] = $fuserdest->user_get_property($val, 'email');
257  $sendtoccuserid[] = $val;
258  }
259  }
260  }
261  $sendtocc = implode(',', $tmparray);
262 
263  if (dol_strlen($sendto)) {
264  // Define $urlwithroot
265  $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
266  $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
267  //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
268 
269  require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
270 
271  $langs->load("commercial");
272 
273  $reg = array();
274  $fromtype = GETPOST('fromtype', 'alpha');
275  if ($fromtype === 'robot') {
276  $from = dol_string_nospecial($conf->global->MAIN_MAIL_EMAIL_FROM, ' ', array(",")).' <'.$conf->global->MAIN_MAIL_EMAIL_FROM.'>';
277  } elseif ($fromtype === 'user') {
278  $from = dol_string_nospecial($user->getFullName($langs), ' ', array(",")).' <'.$user->email.'>';
279  } elseif ($fromtype === 'company') {
280  $from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
281  } elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) {
282  $tmp = explode(',', $user->email_aliases);
283  $from = trim($tmp[($reg[1] - 1)]);
284  } elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) {
285  $tmp = explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES);
286  $from = trim($tmp[($reg[1] - 1)]);
287  } elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) {
288  $sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile';
289  $sql .= ' WHERE rowid = '.(int) $reg[1];
290  $resql = $db->query($sql);
291  $obj = $db->fetch_object($resql);
292  if ($obj) {
293  $from = dol_string_nospecial($obj->label, ' ', array(",")).' <'.$obj->email.'>';
294  }
295  } else {
296  $from = dol_string_nospecial(GETPOST('fromname'), ' ', array(",")).' <'.GETPOST('frommail').'>';
297  }
298 
299  $replyto = dol_string_nospecial(GETPOST('replytoname'), ' ', array(",")).' <'.GETPOST('replytomail').'>';
300  $message = GETPOST('message', 'restricthtml');
301  $subject = GETPOST('subject', 'restricthtml');
302 
303  // Make a change into HTML code to allow to include images from medias directory with an external reabable URL.
304  // <img alt="" src="/dolibarr_dev/htdocs/viewimage.php?modulepart=medias&amp;entity=1&amp;file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
305  // become
306  // <img alt="" src="'.$urlwithroot.'viewimage.php?modulepart=medias&amp;entity=1&amp;file=image/ldestailleur_166x166.jpg" style="height:166px; width:166px" />
307  $message = preg_replace('/(<img.*src=")[^\"]*viewimage\.php([^\"]*)modulepart=medias([^\"]*)file=([^\"]*)("[^\/]*\/>)/', '\1'.$urlwithroot.'/viewimage.php\2modulepart=medias\3file=\4\5', $message);
308 
309  $sendtobcc = GETPOST('sendtoccc');
310  // Autocomplete the $sendtobcc
311  // $autocopy can be MAIN_MAIL_AUTOCOPY_PROPOSAL_TO, MAIN_MAIL_AUTOCOPY_ORDER_TO, MAIN_MAIL_AUTOCOPY_INVOICE_TO, MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO...
312  if (!empty($autocopy)) {
313  $sendtobcc .= (empty($conf->global->$autocopy) ? '' : (($sendtobcc ? ", " : "").$conf->global->$autocopy));
314  }
315 
316  $deliveryreceipt = GETPOST('deliveryreceipt');
317 
318  if ($action == 'send' || $action == 'relance') {
319  $actionmsg2 = $langs->transnoentities('MailSentBy').' '.CMailFile::getValidAddress($from, 4, 0, 1).' '.$langs->transnoentities('To').' '.CMailFile::getValidAddress($sendto, 4, 0, 1);
320  /*if ($message) {
321  $actionmsg = $langs->transnoentities('MailFrom').': '.dol_escape_htmltag($from);
322  $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTo').': '.dol_escape_htmltag($sendto));
323  if ($sendtocc) {
324  $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc').": ".dol_escape_htmltag($sendtocc));
325  }
326  $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic').": ".$subject);
327  $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody').":");
328  $actionmsg = dol_concatdesc($actionmsg, $message);
329  }*/
330  }
331 
332  // Create form object
333  include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
334  $formmail = new FormMail($db);
335  $formmail->trackid = $trackid; // $trackid must be defined
336 
337  $attachedfiles = $formmail->get_attached_files();
338  $filepath = $attachedfiles['paths'];
339  $filename = $attachedfiles['names'];
340  $mimetype = $attachedfiles['mimes'];
341 
342  // Make substitution in email content
343  $substitutionarray = getCommonSubstitutionArray($langs, 0, null, $object);
344  $substitutionarray['__EMAIL__'] = $sendto;
345  $substitutionarray['__CHECK_READ__'] = (is_object($object) && is_object($object->thirdparty)) ? '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.urlencode($object->thirdparty->tag).'&securitykey='.urlencode($conf->global->MAILING_EMAIL_UNSUBSCRIBE_KEY).'" width="1" height="1" style="width:1px;height:1px" border="0"/>' : '';
346 
347  $parameters = array('mode'=>'formemail');
348  complete_substitutions_array($substitutionarray, $langs, $object, $parameters);
349 
350  $subject = make_substitutions($subject, $substitutionarray);
351  $message = make_substitutions($message, $substitutionarray);
352 
353  if (is_object($object) && method_exists($object, 'makeSubstitution')) {
354  $subject = $object->makeSubstitution($subject);
355  $message = $object->makeSubstitution($message);
356  }
357 
358  // Send mail (substitutionarray must be done just before this)
359  if (empty($sendcontext)) {
360  $sendcontext = 'standard';
361  }
362  $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1, '', '', $trackid, '', $sendcontext);
363 
364  if ($mailfile->error) {
365  setEventMessages($mailfile->error, $mailfile->errors, 'errors');
366  $action = 'presend';
367  } else {
368  $result = $mailfile->sendfile();
369  if ($result) {
370  // Initialisation of datas of object to call trigger
371  if (is_object($object)) {
372  if (empty($actiontypecode)) {
373  $actiontypecode = 'AC_OTH_AUTO'; // Event insert into agenda automatically
374  }
375 
376  $object->socid = $sendtosocid; // To link to a company
377  $object->sendtoid = $sendtoid; // To link to contact-addresses. This is an array.
378  $object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
379  $object->actionmsg = $message; // Long text
380  $object->actionmsg2 = $actionmsg2; // Short text ($langs->transnoentities('MailSentBy')...);
381 
382  $object->trackid = $trackid;
383  $object->fk_element = $object->id;
384  $object->elementtype = $object->element;
385  if (is_array($attachedfiles) && count($attachedfiles) > 0) {
386  $object->attachedfiles = $attachedfiles;
387  }
388  if (is_array($sendtouserid) && count($sendtouserid) > 0 && !empty($conf->global->MAIN_MAIL_ENABLED_USER_DEST_SELECT)) {
389  $object->sendtouserid = $sendtouserid;
390  }
391 
392  $object->email_msgid = $mailfile->msgid; // @todo Set msgid into $mailfile after sending
393  $object->email_from = $from;
394  $object->email_subject = $subject;
395  $object->email_to = $sendto;
396  $object->email_tocc = $sendtocc;
397  $object->email_tobcc = $sendtobcc;
398  $object->email_subject = $subject;
399  $object->email_msgid = $mailfile->msgid;
400 
401  // Call of triggers (you should have set $triggersendname to execute trigger. $trigger_name is deprecated)
402  if (!empty($triggersendname) || !empty($trigger_name)) {
403  // Call trigger
404  $result = $object->call_trigger(empty($triggersendname) ? $trigger_name : $triggersendname, $user);
405  if ($result < 0) {
406  $error++;
407  }
408  // End call triggers
409  if ($error) {
410  setEventMessages($object->error, $object->errors, 'errors');
411  }
412  }
413  // End call of triggers
414  }
415 
416  // Redirect here
417  // This avoid sending mail twice if going out and then back to page
418  $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2));
419  setEventMessages($mesg, null, 'mesgs');
420 
421  $moreparam = '';
422  if (isset($paramname2) || isset($paramval2)) {
423  $moreparam .= '&'.($paramname2 ? $paramname2 : 'mid').'='.$paramval2;
424  }
425  header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname ? $paramname : 'id').'='.(is_object($object) ? $object->id : '').$moreparam);
426  exit;
427  } else {
428  $langs->load("other");
429  $mesg = '<div class="error">';
430  if ($mailfile->error) {
431  $mesg .= $langs->transnoentities('ErrorFailedToSendMail', dol_escape_htmltag($from), dol_escape_htmltag($sendto));
432  $mesg .= '<br>'.$mailfile->error;
433  } else {
434  $mesg .= $langs->transnoentities('ErrorFailedToSendMail', dol_escape_htmltag($from), dol_escape_htmltag($sendto));
435  if (!empty($conf->global->MAIN_DISABLE_ALL_MAILS)) {
436  $mesg .= '<br>Feature is disabled by option MAIN_DISABLE_ALL_MAILS';
437  } else {
438  $mesg .= '<br>Unkown Error, please refers to your administrator';
439  }
440  }
441  $mesg .= '</div>';
442 
443  setEventMessages($mesg, null, 'warnings');
444  $action = 'presend';
445  }
446  }
447  } else {
448  $langs->load("errors");
449  setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("MailTo")), null, 'warnings');
450  dol_syslog('Try to send email with no recipient defined', LOG_WARNING);
451  $action = 'presend';
452  }
453  } else {
454  $langs->load("errors");
455  setEventMessages($langs->trans('ErrorFailedToReadObject', $object->element), null, 'errors');
456  dol_syslog('Failed to read data of object id='.$object->id.' element='.$object->element);
457  $action = 'presend';
458  }
459 }
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
dol_escape_htmltag
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields.
Definition: functions.lib.php:1468
GETPOST
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
Definition: functions.lib.php:484
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
dol_add_file_process
dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesession=0, $varfiles='addedfile', $savingdocmask='', $link=null, $trackid='', $generatethumbs=1, $object=null)
Get and save an upload file (for example after submitting a new file a mail form).
Definition: files.lib.php:1634
CMailFile
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Definition: CMailFile.class.php:38
CMailFile\getValidAddress
static getValidAddress($address, $format, $encode=0, $maxnumberofemail=0)
Return a formatted address string for SMTP protocol.
Definition: CMailFile.class.php:1570
dol_delete_file
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1, $nolog=0)
Remove a file or several files with a mask.
Definition: files.lib.php:1231
dol_string_nospecial
dol_string_nospecial($str, $newstr='_', $badcharstoreplace='', $badcharstoremove='')
Clean a string from all punctuation characters to use it as a ref or login.
Definition: functions.lib.php:1376
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
dol_remove_file_process
dol_remove_file_process($filenb, $donotupdatesession=0, $donotdeletefile=1, $trackid='')
Remove an uploaded file (for example after submitting a new file a mail form).
Definition: files.lib.php:1792
User
Class to manage Dolibarr users.
Definition: user.class.php:44
$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
setEventMessages
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
Definition: functions.lib.php:8137
FormMail
Classe permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new For...
Definition: html.formmail.class.php:38
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