dolibarr 24.0.0-beta
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-2025 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";
78// Global variables
79$version = DOL_VERSION;
80$error = 0;
81
82if (!getDolGlobalString('MAILING_LIMIT_SENDBYCLI')) {
83 $conf->global->MAILING_LIMIT_SENDBYCLI = 0;
84}
85
86$langs->loadLangs(array("main", "mails"));
87
88if (!isModEnabled('mailing')) {
89 print 'Module Emailing not enabled';
90 exit(1);
91}
92
93$hookmanager->initHooks(array('cli'));
94
95
96/*
97 * Main
98 */
99
100@set_time_limit(0);
101print "***** ".$script_file." (".$version.") pid=".dol_getmypid()." *****\n";
102
103if (getDolGlobalInt('MAILING_DELAY')) {
104 print 'A delay of '.((float) getDolGlobalInt('MAILING_DELAY')).' seconds has been set between each email'."\n";
105}
106
107//if (getDolGlobalString('MAILING_LIMIT_SENDBYCLI') == '-1') {
108//}
109
110if (!empty($dolibarr_main_db_readonly)) {
111 print "Error: instance in read-only mode\n";
112 exit(1);
113}
114
115$user = new User($db);
116// for signature, we use user send as parameter
117if (!empty($login)) {
118 $user->fetch(0, $login);
119}
121// We get list of emailing id to process
122$sql = "SELECT m.rowid, m.statut as status";
123$sql .= " FROM ".MAIN_DB_PREFIX."mailing as m";
124$sql .= " WHERE m.statut IN (1,2)";
125if ($id != 'all') {
126 $sql .= " AND m.rowid= ".((int) $id);
127 $sql .= " LIMIT 1";
128}
129
130$resql = $db->query($sql);
131if ($resql) {
132 $num = $db->num_rows($resql);
133 $j = 0;
134
135 if ($num) {
136 for ($j = 0; $j < $num && $max != 0; $j++) {
137 $obj = $db->fetch_object($resql);
138
139 dol_syslog("Process mailing with id ".$obj->rowid);
140 print "Process mailing with id ".$obj->rowid."\n";
141
142 if ($obj->status == 1) {
143 $sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut = 2 WHERE rowid = ".((int) $obj->rowid);
144 $result_sql = $db->query($sql);
145 dol_syslog("Started mailing campaign ".$obj->rowid, LOG_DEBUG);
146 }
147
148 $emailing = new Mailing($db);
149 $emailing->fetch($obj->rowid);
150
151 $upload_dir = $conf->mailing->dir_output."/".get_exdir($emailing->id, getDolGlobalInt('MAILING_USE_NEW_PATH_FOR_FILES') ? 0 : 2, 0, 1, $emailing, 'mailing');
152
153 $id = $emailing->id;
154 $subject = $emailing->sujet;
155 $message = $emailing->body;
156 $from = $emailing->email_from;
157 $replyto = $emailing->email_replyto;
158 $errorsto = $emailing->email_errorsto;
159 // Le message est-il en html
160 $msgishtml = -1; // Unknown by default
161 if (preg_match('/[\s\t]*<html>/i', $message)) {
162 $msgishtml = 1;
163 }
164
165 $nbok = 0;
166 $nbko = 0;
167
168 // On choisit les mails non deja envoyes pour ce mailing (statut=0)
169 // ou envoyes en erreur (statut=-1)
170 $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";
171 $sql2 .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc";
172 $sql2 .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".((int) $id);
173 if (getDolGlobalInt('MAILING_LIMIT_SENDBYCLI') > 0 && empty($max)) {
174 $sql2 .= " LIMIT " . getDolGlobalInt('MAILING_LIMIT_SENDBYCLI');
175 } elseif (getDolGlobalInt('MAILING_LIMIT_SENDBYCLI') > 0 && $max > 0) {
176 $sql2 .= " LIMIT ".min(getDolGlobalInt('MAILING_LIMIT_SENDBYCLI'), $max);
177 } elseif ($max > 0) {
178 $sql2 .= " LIMIT ".((int) $max);
179 }
180
181 $resql2 = $db->query($sql2);
182 if ($resql2) {
183 $num2 = $db->num_rows($resql2);
184 dol_syslog("Nb of targets = ".$num2, LOG_DEBUG);
185 print "Nb of targets = ".$num2."\n";
186
187 if ($num2) {
188 $now = dol_now();
189
190 // Positionne date debut envoi
191 $sqlstartdate = "UPDATE ".MAIN_DB_PREFIX."mailing SET date_envoi='".$db->idate($now)."' WHERE rowid=".((int) $id);
192 $resqlstartdate = $db->query($sqlstartdate);
193 if (!$resqlstartdate) {
195 $error++;
196 }
197
198 $thirdpartystatic = new Societe($db);
199
200 // Look on each email and sent message
201 $i = 0;
202 while ($i < $num2) {
203 // Here code is common with same loop ino card.php
204 $res = 1;
205 $now = dol_now();
206
207 $obj = $db->fetch_object($resql2);
208 $max--;
209
210 // sendto en RFC2822
211 $sendto = str_replace(',', ' ', dolGetFirstLastname($obj->firstname, $obj->lastname)." <".$obj->email.">");
212
213 // Make subtsitutions on topic and body
214 $other = explode(';', $obj->other);
215 $tmpfield = explode('=', $other[0], 2);
216 $other1 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
217 $tmpfield = explode('=', $other[1], 2);
218 $other2 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
219 $tmpfield = explode('=', $other[2], 2);
220 $other3 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
221 $tmpfield = explode('=', $other[3], 2);
222 $other4 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
223 $tmpfield = explode('=', $other[4], 2);
224 $other5 = (isset($tmpfield[1]) ? $tmpfield[1] : $tmpfield[0]);
225 $signature = ((!empty($user->signature) && !getDolGlobalString('MAIN_MAIL_DO_NOT_USE_SIGN')) ? $user->signature : '');
226
227 $object = null; // Not defined with mass emailing
228 //$parameters = array('mode' => 'emailing');
229 $substitutionarray = getCommonSubstitutionArray($langs, 0, array('object', 'objectamount'), $object); // Note: On mass emailing, this is null because we don't know object
230
231 // Array of possible substitutions (See also file mailing-send.php that should manage same substitutions)
232 $substitutionarray['__ID__'] = $obj->source_id;
233 if ($obj->source_type == "thirdparty") {
234 $result = $thirdpartystatic->fetch($obj->source_id);
235
236 if ($result > 0) {
237 $substitutionarray['__THIRDPARTY_CUSTOMER_CODE__'] = $thirdpartystatic->code_client;
238 } else {
239 $substitutionarray['__THIRDPARTY_CUSTOMER_CODE__'] = '';
240 }
241 }
242 $substitutionarray['__EMAIL__'] = $obj->email;
243 $substitutionarray['__LASTNAME__'] = $obj->lastname;
244 $substitutionarray['__FIRSTNAME__'] = $obj->firstname;
245 $substitutionarray['__MAILTOEMAIL__'] = '<a href="mailto:'.$obj->email.'">'.$obj->email.'</a>';
246 $substitutionarray['__OTHER1__'] = $other1;
247 $substitutionarray['__OTHER2__'] = $other2;
248 $substitutionarray['__OTHER3__'] = $other3;
249 $substitutionarray['__OTHER4__'] = $other4;
250 $substitutionarray['__OTHER5__'] = $other5;
251 $substitutionarray['__USER_SIGNATURE__'] = $signature; // Signature is empty when ran from command line or taken from user in parameter)
252 $substitutionarray['__SIGNATURE__'] = $signature; // For backward compatibility
253 $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"/>';
254 $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>';
255 $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);
256
257 $onlinepaymentenabled = 0;
258 if (isModEnabled('paypal')) {
259 $onlinepaymentenabled++;
260 }
261 if (isModEnabled('paybox')) {
262 $onlinepaymentenabled++;
263 }
264 if (isModEnabled('stripe')) {
265 $onlinepaymentenabled++;
266 }
267 if ($onlinepaymentenabled && getDolGlobalString('PAYMENT_SECURITY_TOKEN')) {
268 $substitutionarray['__SECUREKEYPAYMENT__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), '2');
269 if (!getDolGlobalString('PAYMENT_SECURITY_TOKEN_UNIQUE')) {
270 $substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), '2');
271 $substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), '2');
272 $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), '2');
273 $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN'), '2');
274 } else {
275 $substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'membersubscription'.$obj->source_id, '2');
276 $substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'order'.$obj->source_id, '2');
277 $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'invoice'.$obj->source_id, '2');
278 $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash(getDolGlobalString('PAYMENT_SECURITY_TOKEN') . 'contractline'.$obj->source_id, '2');
279 }
280 }
281 /* For backward compatibility */
282 if (isModEnabled('paypal') && getDolGlobalString('PAYPAL_SECURITY_TOKEN')) {
283 $substitutionarray['__SECUREKEYPAYPAL__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN'), '2');
284
285 if (!getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) {
286 $substitutionarray['__SECUREKEYPAYPAL_MEMBER__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN'), '2');
287 } else {
288 $substitutionarray['__SECUREKEYPAYPAL_MEMBER__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'membersubscription'.$obj->source_id, '2');
289 }
290
291 if (!getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) {
292 $substitutionarray['__SECUREKEYPAYPAL_ORDER__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN'), '2');
293 } else {
294 $substitutionarray['__SECUREKEYPAYPAL_ORDER__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'order'.$obj->source_id, '2');
295 }
296
297 if (!getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) {
298 $substitutionarray['__SECUREKEYPAYPAL_INVOICE__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN'), '2');
299 } else {
300 $substitutionarray['__SECUREKEYPAYPAL_INVOICE__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'invoice'.$obj->source_id, '2');
301 }
302
303 if (!getDolGlobalString('PAYPAL_SECURITY_TOKEN_UNIQUE')) {
304 $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN'), '2');
305 } else {
306 $substitutionarray['__SECUREKEYPAYPAL_CONTRACTLINE__'] = dol_hash(getDolGlobalString('PAYPAL_SECURITY_TOKEN') . 'contractline'.$obj->source_id, '2');
307 }
308 }
309
310 complete_substitutions_array($substitutionarray, $langs);
311 $newsubject = make_substitutions($subject, $substitutionarray);
312 $newmessage = make_substitutions($message, $substitutionarray);
313
314 $substitutionisok = true;
315
316 $moreinheader = '';
317 if (preg_match('/__UNSUBSCRIBE__/', $message)) {
318 $moreinheader = "List-Unsubscribe: <__UNSUBSCRIBE_URL__>\n";
319 $moreinheader = make_substitutions($moreinheader, $substitutionarray);
320 }
321
322 $arr_file = array();
323 $arr_mime = array();
324 $arr_name = array();
325 $arr_css = array();
326
327 $listofpaths = dol_dir_list($upload_dir, 'all', 0, '', '', 'name', SORT_ASC, 0);
328
329 if (count($listofpaths)) {
330 foreach ($listofpaths as $key => $val) {
331 $arr_file[] = $listofpaths[$key]['fullname'];
332 $arr_mime[] = dol_mimetype($listofpaths[$key]['name']);
333 $arr_name[] = $listofpaths[$key]['name'];
334 }
335 }
336 // Fabrication du mail
337 $trackid = 'emailing-'.$obj->fk_mailing.'-'.$obj->rowid;
338 $upload_dir_tmp = $upload_dir;
339 $mail = new CMailFile($newsubject, $sendto, $from, $newmessage, $arr_file, $arr_mime, $arr_name, '', '', 0, $msgishtml, $errorsto, $arr_css, $trackid, $moreinheader, 'emailing', '', $upload_dir_tmp);
340
341 if ($mail->error) {
342 $res = 0;
343 }
344 if (!$substitutionisok) {
345 $mail->error = 'Some substitution failed';
346 $res = 0;
347 }
348
349 // Send Email
350 if ($res) {
351 $res = $mail->sendfile();
352 }
353
354 if ($res) {
355 // Mail successful
356 $nbok++;
357
358 dol_syslog("ok for emailing id ".$id." #".$i.($mail->error ? ' - '.$mail->error : ''), LOG_DEBUG);
359
360 // Note: If emailing is 100 000 targets, 100 000 entries are added, so we don't enter events for each target here
361 // We must union table llx_mailing_taget for event tab OR enter 1 event with a special table link (id of email in event)
362 // Run trigger
363 /*
364 * if ($obj->source_type == 'contact')
365 * {
366 * $emailing->sendtoid = $obj->source_id;
367 * }
368 * if ($obj->source_type == 'thirdparty')
369 * {
370 * $emailing->socid = $obj->source_id;
371 * }
372 * // Call trigger
373 * $result=$emailing->call_trigger('EMAILING_SENTBYMAIL',$user);
374 * if ($result < 0) $error++;
375 * // End call triggers
376 */
377
378 $sqlok = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
379 $sqlok .= " SET statut = 1, date_envoi = '".$db->idate($now)."' WHERE rowid = ".((int) $obj->rowid);
380 $resqlok = $db->query($sqlok);
381 if (!$resqlok) {
383 $error++;
384 } else {
385 // if cheack read is use then update prospect contact status
386 if (strpos($message, '__CHECK_READ__') !== false) {
387 // Update status communication of thirdparty prospect
388 $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).")";
389 dol_syslog("card.php: set prospect thirdparty status", LOG_DEBUG);
390 $resqlx = $db->query($sqlx);
391 if (!$resqlx) {
393 $error++;
394 }
395
396 // Update status communication of contact prospect
397 $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)";
398 dol_syslog("card.php: set prospect contact status", LOG_DEBUG);
399
400 $resqlx = $db->query($sqlx);
401 if (!$resqlx) {
403 $error++;
404 }
405 }
406
407 if (getDolGlobalInt('MAILING_DELAY')) {
408 usleep((int) ((float) getDolGlobalInt('MAILING_DELAY') * 1000000));
409 }
410 }
411 } else {
412 // Mail failed
413 $nbko++;
414
415 dol_syslog("error for emailing id ".$id." #".$i.($mail->error ? ' - '.$mail->error : ''), LOG_DEBUG);
416
417 $sqlerror = "UPDATE ".MAIN_DB_PREFIX."mailing_cibles";
418 $sqlerror .= " SET statut=-1, date_envoi='".$db->idate($now)."' WHERE rowid = ".((int) $obj->rowid);
419 $resqlerror = $db->query($sqlerror);
420 if (!$resqlerror) {
422 $error++;
423 }
424 }
425
426 $i++;
427 }
428 } else {
429 $mesg = "Emailing id ".$id." has no or no more recipient to target";
430 print $mesg."\n";
431 dol_syslog($mesg, LOG_ERR);
432
433 // Loop finished, set global statut of mail
434 $sql = "UPDATE ".MAIN_DB_PREFIX."mailing SET statut = 3 WHERE rowid = ".((int) $obj->rowid);
435 $result_sql = $db->query($sql);
436
437 dol_syslog("update global status", LOG_DEBUG);
438 print "Update status of emailing id ".$id." to 3\n";
439 }
440 } else {
442 $error++;
443 }
444 }
445 } else {
446 $mesg = "No validated emailing id to send found.";
447 print $mesg."\n";
448 dol_syslog($mesg, LOG_ERR);
449 $error++;
450 }
451} else {
453 $error++;
454}
455
456exit($error);
$id
Support class for third parties, contacts, members, users or resources.
Definition account.php:47
if(! $sortfield) if(! $sortorder) $object
Definition account.php:100
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.
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $db
API class for accounts.
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:64
dol_now($mode='gmt')
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...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
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, $mode=0)
Returns a hash (non reversible encryption) of a string.