dolibarr 21.0.0-alpha
mailing-send.php
Go to the documentation of this file.
1#!/usr/bin/env php
2<?php
3/*
4 * Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
5 * Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
6 * Copyright (C) 2005-2016 Regis Houssin <regis.houssin@inodbox.com>
7 * Copyright (C) 2019 Nicolas ZABOURI <info@inovea-conseil.com>
8 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
9 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <https://www.gnu.org/licenses/>.
23 */
24
31if (!defined('NOSESSION')) {
32 define('NOSESSION', '1');
33}
34
35$sapi_type = php_sapi_name();
36$script_file = basename(__FILE__);
37$path = __DIR__.'/';
38
39// Test if batch mode
40if (substr($sapi_type, 0, 3) == 'cgi') {
41 echo "Error: You are using PHP for CGI. To execute ".$script_file." from command line, you must use PHP for CLI mode.\n";
42 exit(1);
43}
44
45if (!isset($argv[1]) || !$argv[1]) {
46 print "Usage: ".$script_file." (ID_MAILING|all) [userloginforsignature] [maxnbofemails]\n";
47 exit(1);
48}
49
50$id = $argv[1];
51
52if (isset($argv[2]) || !empty($argv[2])) {
53 $login = $argv[2];
54} else {
55 $login = '';
56}
57
58$max = -1;
59
60if (isset($argv[3]) || !empty($argv[3])) {
61 $max = $argv[3];
62}
63
64
65require_once $path."../../htdocs/master.inc.php";
66require_once DOL_DOCUMENT_ROOT.'/core/lib/functionscli.lib.php';
67require_once DOL_DOCUMENT_ROOT."/core/class/CMailFile.class.php";
68require_once DOL_DOCUMENT_ROOT."/comm/mailing/class/mailing.class.php";
69
70// Global variables
71$version = DOL_VERSION;
72$error = 0;
73
74if (!getDolGlobalString('MAILING_LIMIT_SENDBYCLI')) {
75 $conf->global->MAILING_LIMIT_SENDBYCLI = 0;
76}
77
78$langs->loadLangs(array("main", "mails"));
79
80if (!isModEnabled('mailing')) {
81 print 'Module Emailing not enabled';
82 exit(1);
83}
84
85$hookmanager->initHooks(array('cli'));
86
87
88/*
89 * Main
90 */
91
92@set_time_limit(0);
93print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
94
95if (getDolGlobalInt('MAILING_DELAY')) {
96 print 'A delay of '.((float) getDolGlobalInt('MAILING_DELAY')).' seconds has been set between each email'."\n";
97}
98
99if (getDolGlobalString('MAILING_LIMIT_SENDBYCLI') == '-1') {
100}
101
102if (!empty($dolibarr_main_db_readonly)) {
103 print "Error: instance in read-only mode\n";
104 exit(1);
105}
106
107$user = new User($db);
108// for signature, we use user send as parameter
109if (!empty($login)) {
110 $user->fetch('', $login);
111}
113// We get list of emailing id to process
114$sql = "SELECT m.rowid, m.statut as status";
115$sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
116$sql .= " WHERE m.statut IN (1,2)";
117if ($id != 'all') {
118 $sql .= " AND m.rowid= ".((int) $id);
119 $sql .= " LIMIT 1";
120}
121
122$resql = $db->query($sql);
123if ($resql) {
124 $num = $db->num_rows($resql);
125 $j = 0;
126
127 if ($num) {
128 for ($j = 0; $j < $num && $max != 0; $j++) {
129 $obj = $db->fetch_object($resql);
130
131 dol_syslog("Process mailing with id ".$obj->rowid);
132 print "Process mailing with id ".$obj->rowid."\n";
133
134 if ($obj->status == 1) {
135 $sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut = 2 WHERE rowid = ".((int) $obj->rowid);
136 $result_sql = $db->query($sql);
137 dol_syslog("Started mailing campaign ".$obj->rowid, LOG_DEBUG);
138 }
139
140 $emailing = new Mailing($db);
141 $emailing->fetch($obj->rowid);
142
143 $upload_dir = $conf->mailing->dir_output."/".get_exdir($emailing->id, 2, 0, 1, $emailing, 'mailing');
144
145 $id = $emailing->id;
146 $subject = $emailing->sujet;
147 $message = $emailing->body;
148 $from = $emailing->email_from;
149 $replyto = $emailing->email_replyto;
150 $errorsto = $emailing->email_errorsto;
151 // Le message est-il en html
152 $msgishtml = -1; // Unknown by default
153 if (preg_match('/[\s\t]*<html>/i', $message)) {
154 $msgishtml = 1;
155 }
156
157 $nbok = 0;
158 $nbko = 0;
159
160 // On choisit les mails non deja envoyes pour ce mailing (statut=0)
161 // ou envoyes en erreur (statut=-1)
162 $sql2 = "SELECT mc.rowid, mc.fk_mailing, mc.lastname, mc.firstname, mc.email, mc.other, mc.source_url, mc.source_id, mc.source_type, mc.tag";
163 $sql2 .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
164 $sql2 .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".((int) $id);
165 if (getDolGlobalInt('MAILING_LIMIT_SENDBYCLI') > 0 && empty($max)) {
166 $sql2 .= " LIMIT " . getDolGlobalInt('MAILING_LIMIT_SENDBYCLI');
167 } elseif (getDolGlobalInt('MAILING_LIMIT_SENDBYCLI') > 0 && $max > 0) {
168 $sql2 .= " LIMIT ".min(getDolGlobalInt('MAILING_LIMIT_SENDBYCLI'), $max);
169 } elseif ($max > 0) {
170 $sql2 .= " LIMIT ".((int) $max);
171 }
172
173 $resql2 = $db->query($sql2);
174 if ($resql2) {
175 $num2 = $db->num_rows($resql2);
176 dol_syslog("Nb of targets = ".$num2, LOG_DEBUG);
177 print "Nb of targets = ".$num2."\n";
178
179 if ($num2) {
180 $now = dol_now();
181
182 // Positionne date debut envoi
183 $sqlstartdate = "UPDATE ".MAIN_DB_PREFIX."mailing SET date_envoi='".$db->idate($now)."' WHERE rowid=".((int) $id);
184 $resqlstartdate = $db->query($sqlstartdate);
185 if (!$resqlstartdate) {
186 dol_print_error($db);
187 $error++;
188 }
189
190 $thirdpartystatic = new Societe($db);
191
192 // Look on each email and sent message
193 $i = 0;
194 while ($i < $num2) {
195 // Here code is common with same loop ino card.php
196 $res = 1;
197 $now = dol_now();
198
199 $obj = $db->fetch_object($resql2);
200 $max--;
201
202 // sendto en RFC2822
203 $sendto = str_replace(',', ' ', dolGetFirstLastname($obj->firstname, $obj->lastname)." <".$obj->email.">");
204
205 // Make subtsitutions on topic and body
206 $other = explode(';', $obj->other);
207 $tmpfield = explode('=', $other[0], 2);
208 $other1 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
209 $tmpfield = explode('=', $other[1], 2);
210 $other2 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
211 $tmpfield = explode('=', $other[2], 2);
212 $other3 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
213 $tmpfield = explode('=', $other[3], 2);
214 $other4 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
215 $tmpfield = explode('=', $other[4], 2);
216 $other5 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
217 $signature = ((!empty($user->signature) && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $user->signature : '');
218
219 $object = null; // Not defined with mass emailing
220 $parameters = array('mode' => 'emailing');
221 $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'), $object); // Note: On mass emailing, this is null because we don't know object
222
223 // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
224 $substitutionarray['__ID__'] = $obj->source_id;
225 if ($obj->source_type == "thirdparty") {
226 $result = $thirdpartystatic->fetch($obj->source_id);
227
228 if ($result > 0) {
229 $substitutionarray['__THIRDPARTY_CUSTOMER_CODE__'] = $thirdpartystatic->code_client;
230 } else {
231 $substitutionarray['__THIRDPARTY_CUSTOMER_CODE__'] = '';
232 }
233 }
234 $substitutionarray['__EMAIL__'] = $obj->email;
235 $substitutionarray['__LASTNAME__'] = $obj->lastname;
236 $substitutionarray['__FIRSTNAME__'] = $obj->firstname;
237 $substitutionarray['__MAILTOEMAIL__'] = '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>';
238 $substitutionarray['__OTHER1__'] = $other1;
239 $substitutionarray['__OTHER2__'] = $other2;
240 $substitutionarray['__OTHER3__'] = $other3;
241 $substitutionarray['__OTHER4__'] = $other4;
242 $substitutionarray['__OTHER5__'] = $other5;
243 $substitutionarray['__USER_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter)
244 $substitutionarray['__SIGNATURE__'] = $signature; // For backward compatibility
245 $substitutionarray['__CHECK_READ__'] = '<img src="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-read.php?tag='.urlencode($obj->tag).'&securitykey='.dol_hash(getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY') . "-".$obj->tag."-".$obj->email."-".$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid).'" width="1" height="1" style="width:1px;height:1px" border="0"/>';
246 $substitutionarray['__UNSUBSCRIBE__'] = '<a href="'.DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.dol_hash(getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY') . "-".$obj->tag."-".$obj->email."-".$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid).'" target="_blank">'.$langs->trans("MailUnsubcribe").'</a>';
247 $substitutionarray['__UNSUBSCRIBE_URL__'] = DOL_MAIN_URL_ROOT.'/public/emailing/mailing-unsubscribe.php?tag='.urlencode($obj->tag).'&unsuscrib=1&securitykey='.dol_hash(getDolGlobalString('MAILING_EMAIL_UNSUBSCRIBE_KEY') . "-".$obj->tag."-".$obj->email."-".$obj->rowid, "md5").'&email='.urlencode($obj->email).'&mtid='.((int) $obj->rowid);
248
249 $onlinepaymentenabled = 0;
250 if (isModEnabled('paypal')) {
251 $onlinepaymentenabled++;
252 }
253 if (isModEnabled('paybox')) {
254 $onlinepaymentenabled++;
255 }
256 if (isModEnabled('stripe')) {
257 $onlinepaymentenabled++;
258 }
259 if ($onlinepaymentenabled && getDolGlobalString('PAYMENT_SECURITY_TOKEN')) {
260 $substitutionarray['__SECUREKEYPAYMENT__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), '2');
261 if (!getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
262 $substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), '2');
263 $substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), '2');
264 $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), '2');
265 $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), '2');
266 } else {
267 $substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'membersubscription'.$obj->source_id, '2');
268 $substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'order'.$obj->source_id, '2');
269 $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'invoice'.$obj->source_id, '2');
270 $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'contractline'.$obj->source_id, '2');
271 }
272 }
273 /* For backward compatibility */
274 if (isModEnabled('paypal') && getDolGlobalString('PAYPAL_SECURITY_TOKEN')) {
275 $substitutionarray['__SECUREKEYPAYPAL__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN'), '2');
276
277 if (!getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) {
278 $substitutionarray['__SECUREKEYPAYPAL_MEMBER__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN'), '2');
279 } else {
280 $substitutionarray['__SECUREKEYPAYPAL_MEMBER__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'membersubscription'.$obj->source_id, '2');
281 }
282
283 if (!getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) {
284 $substitutionarray['__SECUREKEYPAYPAL_ORDER__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN'), '2');
285 } else {
286 $substitutionarray['__SECUREKEYPAYPAL_ORDER__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'order'.$obj->source_id, '2');
287 }
288
289 if (!getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) {
290 $substitutionarray['__SECUREKEYPAYPAL_INVOICE__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN'), '2');
291 } else {
292 $substitutionarray['__SECUREKEYPAYPAL_INVOICE__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'invoice'.$obj->source_id, '2');
293 }
294
295 if (!getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) {
296 $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN'), '2');
297 } else {
298 $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'contractline'.$obj->source_id, '2');
299 }
300 }
301
302 complete_substitutions_array($substitutionarray, $langs);
303 $newsubject = make_substitutions($subject, $substitutionarray);
304 $newmessage = make_substitutions($message, $substitutionarray);
305
306 $substitutionisok = true;
307
308 $moreinheader = '';
309 if (preg_match('/__UNSUBSCRIBE__/', $message)) {
310 $moreinheader = "List-Unsubscribe: <__UNSUBSCRIBE_URL__>\n";
311 $moreinheader = make_substitutions($moreinheader, $substitutionarray);
312 }
313
314 $arr_file = array();
315 $arr_mime = array();
316 $arr_name = array();
317 $arr_css = array();
318
319 $listofpaths = dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0);
320
321 if (count($listofpaths)) {
322 foreach ($listofpaths as $key => $val) {
323 $arr_file[] = $listofpaths[$key]['fullname'];
324 $arr_mime[] = dol_mimetype($listofpaths[$key]['name']);
325 $arr_name[] = $listofpaths[$key]['name'];
326 }
327 }
328 // Fabrication du mail
329 $trackid = 'emailing-'.$obj->fk_mailing.'-'.$obj->rowid;
330 $upload_dir_tmp = $upload_dir;
331 $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, $moreinheader, 'emailing', '', $upload_dir_tmp);
332
333 if ($mail->error) {
334 $res = 0;
335 }
336 if (!$substitutionisok) {
337 $mail->error = 'Some substitution failed';
338 $res = 0;
339 }
340
341 // Send Email
342 if ($res) {
343 $res = $mail->sendfile();
344 }
345
346 if ($res) {
347 // Mail successful
348 $nbok++;
349
350 dol_syslog("ok for emailing id ".$id." #".$i.($mail->error ? ' - '.$mail->error : ''), LOG_DEBUG);
351
352 // Note: If emailing is 100 000 targets, 100 000 entries are added, so we don't enter events for each target here
353 // We must union table llx_mailing_taget for event tab OR enter 1 event with a special table link (id of email in event)
354 // Run trigger
355 /*
356 * if ($obj->source_type == 'contact')
357 * {
358 * $emailing->sendtoid = $obj->source_id;
359 * }
360 * if ($obj->source_type == 'thirdparty')
361 * {
362 * $emailing->socid = $obj->source_id;
363 * }
364 * // Call trigger
365 * $result=$emailing->call_trigger('EMAILING_SENTBYMAIL',$user);
366 * if ($result < 0) $error++;
367 * // End call triggers
368 */
369
370 $sqlok = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
371 $sqlok .= " SET statut = 1, date_envoi = '".$db->idate($now)."' WHERE rowid = ".((int) $obj->rowid);
372 $resqlok = $db->query($sqlok);
373 if (!$resqlok) {
374 dol_print_error($db);
375 $error++;
376 } else {
377 // if cheack read is use then update prospect contact status
378 if (strpos($message, '__CHECK_READ__') !== false) {
379 // Update status communication of thirdparty prospect
380 $sqlx = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT source_id FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE rowid=".((int) $obj->rowid).")";
381 dol_syslog("card.php: set prospect thirdparty status", LOG_DEBUG);
382 $resqlx = $db->query($sqlx);
383 if (!$resqlx) {
384 dol_print_error($db);
385 $error++;
386 }
387
388 // Update status communication of contact prospect
389 $sqlx = "UPDATE ".MAIN_DB_PREFIX."societe SET fk_stcomm=2 WHERE rowid IN (SELECT sc.fk_soc FROM ".MAIN_DB_PREFIX."socpeople AS sc INNER JOIN ".MAIN_DB_PREFIX."mailing_cibles AS mc ON mc.rowid=".((int) $obj->rowid)." AND mc.source_type = 'contact' AND mc.source_id = sc.rowid)";
390 dol_syslog("card.php: set prospect contact status", LOG_DEBUG);
391
392 $resqlx = $db->query($sqlx);
393 if (!$resqlx) {
394 dol_print_error($db);
395 $error++;
396 }
397 }
398
399 if (getDolGlobalInt('MAILING_DELAY')) {
400 usleep((int) ((float) getDolGlobalInt('MAILING_DELAY') * 1000000));
401 }
402 }
403 } else {
404 // Mail failed
405 $nbko++;
406
407 dol_syslog("error for emailing id ".$id." #".$i.($mail->error ? ' - '.$mail->error : ''), LOG_DEBUG);
408
409 $sqlerror = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
410 $sqlerror .= " SET statut=-1, date_envoi='".$db->idate($now)."' WHERE rowid=".$obj->rowid;
411 $resqlerror = $db->query($sqlerror);
412 if (!$resqlerror) {
413 dol_print_error($db);
414 $error++;
415 }
416 }
417
418 $i++;
419 }
420 } else {
421 //$mesg = "Emailing id ".$id." has no recipient to target";
422 print $mesg."\n";
423 dol_syslog($mesg, LOG_ERR);
424
425 // Loop finished, set global statut of mail
426 $sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut=3 WHERE rowid=".$obj->rowid;
427 $result_sql = $db->query($sql);
428
429 dol_syslog("update global status", LOG_DEBUG);
430 print "Update status of emailing id ".$id." to ".$statut."\n";
431 }
432 } else {
433 dol_print_error($db);
434 $error++;
435 }
436 }
437 } else {
438 $mesg = "No validated emailing id to send found.";
439 print $mesg."\n";
440 dol_syslog($mesg, LOG_ERR);
441 $error++;
442 }
443} else {
444 dol_print_error($db);
445 $error++;
446}
447
448exit($error);
$id
Definition account.php:39
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Class to manage emailings module.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to manage Dolibarr users.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
Definition files.lib.php:63
dol_getmypid()
Return getmypid() or random PID when function is disabled Some web hosts disable this php function fo...
dol_mimetype($file, $default='application/octet-stream', $mode=0)
Return MIME type of a file from its name with extension.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dolGetFirstLastname($firstname, $lastname, $nameorder=-1)
Return firstname and lastname in correct order.
complete_substitutions_array(&$substitutionarray, $outputlangs, $object=null, $parameters=null, $callfunc="completesubstitutionarray")
Complete the $substitutionarray with more entries coming from external module that had set the "subst...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart='')
Return a path to have a the directory according to object where files are stored.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
dol_hash($chain, $type='0', $nosalt=0)
Returns a hash (non reversible encryption) of a string.