dolibarr 18.0.6
partnershiputils.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2021 NextGestion <contact@nextgestion.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
24//require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
25//require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
26require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
27require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php';
31require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
32require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
33require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
34
39{
40 public $db;
41 public $error;
42 public $errors = array();
43
44 public $output; // To store output of some cron methods
45
46
52 public function __construct($db)
53 {
54 $this->db = $db;
55 return 1;
56 }
57
66 {
67 global $conf, $langs, $user;
68
69 $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty');
70
71 if ($managedfor != 'member') {
72 return 0; // If option 'PARTNERSHIP_IS_MANAGED_FOR' = 'thirdparty', this cron job does nothing.
73 }
74
75 $partnership = new Partnership($this->db);
76 $MAXPERCALL = (empty($conf->global->PARTNERSHIP_MAX_EXPIRATION_CANCEL_PER_CALL) ? 25 : $conf->global->PARTNERSHIP_MAX_EXPIRATION_CANCEL_PER_CALL); // Limit to 25 per call
77
78 $langs->loadLangs(array("partnership", "member"));
79
80 $error = 0;
81 $erroremail = '';
82 $this->output = '';
83 $this->error = '';
84 $partnershipsprocessed = array();
85
86 $gracedelay = $conf->global->PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL;
87 if ($gracedelay < 1) {
88 $this->error = 'BadValueForDelayBeforeCancelCheckSetup';
89 return -1;
90 }
91
92 dol_syslog(get_class($this)."::doCancelStatusOfMemberPartnership cancel expired partnerships with grace delay of ".$gracedelay);
93
94 $now = dol_now();
95 $datetotest = dol_time_plus_duree($now, -1 * abs($gracedelay), 'd');
96
97 $this->db->begin();
98
99 $sql = "SELECT p.rowid, p.fk_member, p.status";
100 $sql .= ", d.datefin, d.fk_adherent_type, dty.subscription";
101 $sql .= " FROM ".MAIN_DB_PREFIX."partnership as p";
102 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d on (d.rowid = p.fk_member)";
103 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent_type as dty on (dty.rowid = d.fk_adherent_type)";
104 $sql .= " WHERE fk_member > 0";
105 $sql .= " AND (d.datefin < '".$this->db->idate($datetotest)."' AND dty.subscription = 1)";
106 $sql .= " AND p.status = ".((int) $partnership::STATUS_APPROVED); // Only accepted not yet canceled
107 $sql .= $this->db->order('d.rowid', 'ASC');
108 // Limit is managed into loop later
109
110 $resql = $this->db->query($sql);
111 if ($resql) {
112 $numofexpiredmembers = $this->db->num_rows($resql);
113
114 $somethingdoneonpartnership = 0;
115 $ifetchpartner = 0;
116 while ($ifetchpartner < $numofexpiredmembers) {
117 $ifetchpartner++;
118
119 $obj = $this->db->fetch_object($resql);
120 if ($obj) {
121 if (!empty($partnershipsprocessed[$obj->rowid])) continue;
122
123 if ($somethingdoneonpartnership >= $MAXPERCALL) {
124 dol_syslog("We reach the limit of ".$MAXPERCALL." partnership processed, so we quit loop for this batch doCancelStatusOfMemberPartnership to avoid to reach email quota.", LOG_WARNING);
125 break;
126 }
127
128 $object = new Partnership($this->db);
129 $object->fetch($obj->rowid);
130
131 // Get expiration date
132 $expirationdate = $obj->datefin;
133
134 if ($expirationdate && $expirationdate < $now) { // If contract expired (we already had a test into main select, this is a security)
135 $somethingdoneonpartnership++;
136
137 $result = $object->cancel($user, 0);
138 // $conf->global->noapachereload = null;
139 if ($result < 0) {
140 $error++;
141 $this->error = $object->error;
142 if (is_array($object->errors) && count($object->errors)) {
143 if (is_array($this->errors)) $this->errors = array_merge($this->errors, $object->errors);
144 else $this->errors = $object->errors;
145 }
146 } else {
147 $partnershipsprocessed[$object->id] = $object->ref;
148
149 // Send an email to inform member
150 $labeltemplate = '('.getDolGlobalString('PARTNERSHIP_SENDMAIL_IF_AUTO_CANCEL', 'SendingEmailOnPartnershipCanceled').')';
151
152 dol_syslog("Now we will send an email to member id=".$object->fk_member." with label ".$labeltemplate);
153
154 // Send deployment email
155 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
156 include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
157 $formmail = new FormMail($this->db);
158
159 // Define output language
160 $outputlangs = $langs;
161 $newlang = '';
162 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
163 if (!empty($newlang)) {
164 $outputlangs = new Translate("", $conf);
165 $outputlangs->setDefaultLang($newlang);
166 $outputlangs->loadLangs(array('main', 'member', 'partnership'));
167 }
168
169 $arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'partnership_send', $user, $outputlangs, 0, 1, $labeltemplate);
170
171 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
172 complete_substitutions_array($substitutionarray, $outputlangs, $object);
173
174 $subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs);
175 $msg = make_substitutions($arraydefaultmessage->content, $substitutionarray, $outputlangs);
176 $from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
177
178 // We are in the case of autocancellation subscription because of missing backlink
179 $fk_partner = $object->fk_member;
180
181 $adherent = new Adherent($this->db);
182 $adherent->fetch($object->fk_member);
183 $sendto = $adherent->email;
184
185 $trackid = 'par'.$object->id;
186 $sendcontext = 'standard';
187
188 $cmail = new CMailFile($subject, $sendto, $from, $msg, array(), array(), array(), '', '', 0, 1, '', '', $trackid, '', $sendcontext);
189
190 $result = $cmail->sendfile();
191
192 if (!$result || !empty($cmail->error) || !empty($cmail->errors)) {
193 $erroremail .= ($erroremail ? ', ' : '').$cmail->error;
194 $this->errors[] = $cmail->error;
195 if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors;
196 } else {
197 // Initialisation of datas of object to call trigger
198 if (is_object($object)) {
199 $actiontypecode = 'AC_OTH_AUTO'; // Event insert into agenda automatically
200 $attachedfiles = array();
201
202 $object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
203 $object->actionmsg = $arraydefaultmessage->topic."\n".$arraydefaultmessage->content; // Long text
204 $object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref);; // Short text ($langs->transnoentities('MailSentBy')...);
205 if (!empty($conf->global->MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT)) {
206 $object->actionmsg2 = $subject; // Short text
207 }
208
209 $object->trackid = $trackid;
210 $object->fk_element = $object->id;
211 $object->elementtype = $object->element;
212 if (is_array($attachedfiles) && count($attachedfiles) > 0) {
213 $object->attachedfiles = $attachedfiles;
214 }
215
216 $object->email_from = $from;
217 $object->email_subject = $subject;
218 $object->email_to = $sendto;
219 $object->email_subject = $subject;
220
221 $triggersendname = 'PARTNERSHIP_SENTBYMAIL';
222 // Call of triggers (you should have set $triggersendname to execute trigger)
223 if (!empty($triggersendname)) {
224 $result = $object->call_trigger($triggersendname, $user);
225 if ($result < 0) {
226 $error++;
227 }
228 }
229 // End call of triggers
230 }
231 }
232 }
233 }
234 }
235 }
236 } else {
237 $error++;
238 $this->error = $this->db->lasterror();
239 }
240
241 if (!$error) {
242 $this->db->commit();
243 $this->output = $numofexpiredmembers.' expired partnership members found'."\n";
244 if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail;
245 } else {
246 $this->db->rollback();
247 $this->output = "Rollback after error\n";
248 $this->output .= $numofexpiredmembers.' expired partnership members found'."\n";
249 if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail;
250 }
251
252 return ($error ? 1 : 0);
253 }
254
255
265 {
266 global $conf, $langs, $user;
267
268 $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR');
269
270 $partnership = new Partnership($this->db);
271 if (empty($maxpercall)) {
272 $maxpercall = getDolGlobalInt('PARTNERSHIP_MAX_WARNING_BACKLINK_PER_CALL', 10);
273 }
274
275 $langs->loadLangs(array("partnership", "member"));
276
277 $error = 0;
278 $erroremail = '';
279 $this->output = '';
280 $this->error = '';
281 $partnershipsprocessed = array();
282 $emailnotfound = '';
283 $websitenotfound = '';
284
285 /*$gracedelay = getDolGlobalInt('PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL');
286 if ($gracedelay < 1) {
287 $this->error = 'BadValueForDelayBeforeCancelCheckSetup';
288 return -1;
289 }*/
290
291 $fk_partner = ($managedfor == 'member') ? 'fk_member' : 'fk_soc';
292
293 dol_syslog(get_class($this)."::doWarningOfPartnershipIfDolibarrBacklinkNotfound Warning of partnership");
294
295 $now = dol_now();
296 //$datetotest = dol_time_plus_duree($now, -1 * abs($gracedelay), 'd');
297
298 $this->db->begin();
299
300 $sql = "SELECT p.rowid, p.status, p.".$fk_partner;
301 $sql .= ", p.url_to_check, p.last_check_backlink";
302 $sql .= ', partner.url, partner.email';
303 $sql .= " FROM ".MAIN_DB_PREFIX."partnership as p";
304 if ($managedfor == 'member') {
305 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as partner on (partner.rowid = p.fk_member)";
306 } else {
307 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as partner on (partner.rowid = p.fk_soc)";
308 }
309 $sql .= " WHERE p.".$fk_partner." > 0";
310 $sql .= " AND p.status = ".((int) $partnership::STATUS_APPROVED); // Only accepted and not yet canceled
311 $sql .= " AND (p.last_check_backlink IS NULL OR p.last_check_backlink <= '".$this->db->idate($now - 24 * 3600)."')"; // Never more than 1 check every day to check that website contains a referal link.
312 $sql .= $this->db->order('p.rowid', 'ASC');
313 // Limit is managed into loop later
314
315 $resql = $this->db->query($sql);
316 if ($resql) {
317 $numofexpiredmembers = $this->db->num_rows($resql);
318 $somethingdoneonpartnership = 0;
319 $ifetchpartner = 0;
320 while ($ifetchpartner < $numofexpiredmembers) {
321 $ifetchpartner++;
322
323 $obj = $this->db->fetch_object($resql);
324 if ($obj) {
325 if (!empty($partnershipsprocessed[$obj->rowid])) {
326 continue;
327 }
328
329 if ($somethingdoneonpartnership >= $maxpercall) {
330 dol_syslog("We reach the limit of ".$maxpercall." partnership processed, so we quit loop for this batch doWarningOfPartnershipIfDolibarrBacklinkNotfound to avoid to reach email quota.", LOG_WARNING);
331 break;
332 }
333
334 $backlinkfound = 0;
335
336 $object = new Partnership($this->db);
337 $object->fetch($obj->rowid);
338
339 if ($managedfor == 'member') {
340 $fk_partner = $object->fk_member;
341 } else {
342 $fk_partner = $object->fk_soc;
343 }
344
345 $website = (empty($obj->url_to_check) ? $obj->url : $obj->url_to_check);
346
347 if (empty($website)) {
348 $websitenotfound .= ($websitenotfound ? ', ' : '').'Website not found for id="'.$fk_partner.'"'."\n";
349 } else {
350 $backlinkfound = $this->checkDolibarrBacklink($website);
351 }
352
353 if (!$backlinkfound) {
354 $tmpcount = $object->count_last_url_check_error + 1;
355
356 $nbminbacklinkerrorforcancel = getDolGlobalString('PARTNERSHIP_MIN_BACKLINK_ERROR_FOR_CANCEL', 3);
357 $nbmaxbacklinkerrorforcancel = getDolGlobalString('PARTNERSHIP_MAX_BACKLINK_ERROR_FOR_CANCEL', $nbminbacklinkerrorforcancel + 2);
358
359 // If $nbminbacklinkerrorforemail = 0, no autoemail
360 if ($nbminbacklinkerrorforcancel > 0) {
361 if ($tmpcount > $nbminbacklinkerrorforcancel && $tmpcount <= $nbmaxbacklinkerrorforcancel) { // Send Warning Email
362 if (!empty($obj->email)) {
363 $emailnotfound .= ($emailnotfound ? ', ' : '').'Email not found for id="'.$fk_partner.'"'."\n";
364 } else {
365 // Example: 'SendingEmailOnPartnershipWillSoonBeCanceled'
366 $labeltemplate = '('.getDolGlobalString('PARTNERSHIP_SENDMAIL_IF_NO_LINK', 'SendingEmailOnPartnershipWillSoonBeCanceled').')';
367
368 dol_syslog("Now we will send an email to partner id=".$fk_partner." with label ".$labeltemplate);
369
370 // Send deployment email
371 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
372 include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
373 $formmail = new FormMail($this->db);
374
375 // Define output language
376 $outputlangs = $langs;
377 $newlang = '';
378 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09');
379 if (!empty($newlang)) {
380 $outputlangs = new Translate("", $conf);
381 $outputlangs->setDefaultLang($newlang);
382 $outputlangs->loadLangs(array('main', 'member', 'partnership'));
383 }
384
385 $arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'partnership_send', $user, $outputlangs, 0, 1, $labeltemplate);
386
387 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
388 complete_substitutions_array($substitutionarray, $outputlangs, $object);
389
390 $subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs);
391 $msg = make_substitutions($arraydefaultmessage->content, $substitutionarray, $outputlangs);
392 $from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>';
393
394 $sendto = $obj->email;
395
396 $trackid = 'par'.$object->id;
397 $sendcontext = 'standard';
398
399 $cmail = new CMailFile($subject, $sendto, $from, $msg, array(), array(), array(), '', '', 0, 1, '', '', $trackid, '', $sendcontext);
400
401 $result = $cmail->sendfile();
402
403 if (!$result || !empty($cmail->error) || !empty($cmail->errors)) {
404 $erroremail .= ($erroremail ? ', ' : '').$cmail->error;
405 $this->errors[] = $cmail->error;
406 if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors;
407 } else {
408 // Initialisation of datas of object to call trigger
409 if (is_object($object)) {
410 $actiontypecode = 'AC_OTH_AUTO'; // Event insert into agenda automatically
411 $attachedfiles = array();
412
413 if ($managedfor != 'member') {
414 $object->socid = $fk_partner; // To link to a company
415 }
416 $object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
417 $object->actionmsg = $arraydefaultmessage->topic."\n".$arraydefaultmessage->content; // Long text
418 $object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref);; // Short text ($langs->transnoentities('MailSentBy')...);
419 if (!empty($conf->global->MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT)) {
420 $object->actionmsg2 = $subject; // Short text
421 }
422
423 $object->trackid = $trackid;
424 $object->fk_element = $object->id;
425 $object->elementtype = $object->element;
426 if (is_array($attachedfiles) && count($attachedfiles) > 0) {
427 $object->attachedfiles = $attachedfiles;
428 }
429
430 $object->email_from = $from;
431 $object->email_subject = $subject;
432 $object->email_to = $sendto;
433 $object->email_subject = $subject;
434
435 $triggersendname = 'PARTNERSHIP_SENTBYMAIL';
436 // Call of triggers (you should have set $triggersendname to execute trigger)
437 if (!empty($triggersendname)) {
438 $result = $object->call_trigger($triggersendname, $user);
439 if ($result < 0) {
440 $error++;
441 }
442 }
443 // End call of triggers
444 }
445 }
446 }
447 } elseif ($tmpcount > $nbmaxbacklinkerrorforcancel) { // Cancel Partnership
448 $object->status = $object::STATUS_CANCELED;
449 $object->reason_decline_or_cancel = $langs->trans('BacklinkNotFoundOnPartnerWebsite');
450 }
451 }
452
453 $object->count_last_url_check_error = $tmpcount;
454 } else {
455 $object->count_last_url_check_error = 0;
456 $object->reason_decline_or_cancel = '';
457 }
458
459 $partnershipsprocessed[$object->id] = $object->ref;
460
461 $object->last_check_backlink = $now;
462
463 $object->update($user);
464 }
465 }
466 } else {
467 $error++;
468 $this->error = $this->db->lasterror();
469 }
470
471 if (!$error) {
472 $this->db->commit();
473 $this->output = "";
474 } else {
475 $this->db->rollback();
476 $this->output = "Rollback after error\n";
477 }
478 $this->output .= $numofexpiredmembers.' partnership checked'."\n";
479 if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail."\n";
480 if ($emailnotfound) $this->output .= '. Email not found for some partner : '.$emailnotfound."\n";
481 if ($websitenotfound) $this->output .= '. Website not found for some partner : '.$websitenotfound."\n";
482 $this->output .= "\nSQL used to find partnerships to scan: ".$sql;
483
484 return ($error ? 1 : 0);
485 }
486
493 private function checkDolibarrBacklink($website = null)
494 {
495 global $conf;
496
497 $found = 0;
498 $error = 0;
499 $webcontent = '';
500
501 // $website = 'https://nextgestion.com/'; // For Test
502 $tmpgeturl = getURLContent($website, 'GET', '', 1, array(), array('http', 'https'), 0);
503 if ($tmpgeturl['curl_error_no']) {
504 $error++;
505 dol_syslog('Error getting '.$website.': '.$tmpgeturl['curl_error_msg']);
506 } elseif ($tmpgeturl['http_code'] != '200') {
507 $error++;
508 dol_syslog('Error getting '.$website.': '.$tmpgeturl['curl_error_msg']);
509 } else {
510 $urlContent = $tmpgeturl['content'];
511 $dom = new DOMDocument();
512 @$dom->loadHTML($urlContent);
513
514 $xpath = new DOMXPath($dom);
515 $hrefs = $xpath->evaluate("//a");
516
517 for ($i = 0; $i < $hrefs->length; $i++) {
518 $href = $hrefs->item($i);
519 $url = $href->getAttribute('href');
520 $url = filter_var($url, FILTER_SANITIZE_URL);
521 if (!filter_var($url, FILTER_VALIDATE_URL) === false) {
522 $webcontent .= $url;
523 }
524 }
525 }
526
527 if ($webcontent && !empty($conf->global->PARTNERSHIP_BACKLINKS_TO_CHECK) && preg_match('/'.$conf->global->PARTNERSHIP_BACKLINKS_TO_CHECK.'/', $webcontent)) {
528 $found = 1;
529 }
530
531 return $found;
532 }
533}
Class to manage members of a foundation.
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Classe permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new For...
Class for Partnership.
Class with cron tasks of Partnership module.
doWarningOfPartnershipIfDolibarrBacklinkNotfound($maxpercall=0)
Action executed by scheduler to check if Dolibarr backlink not found on partner website.
$db
To store db handler.
checkDolibarrBacklink($website=null)
Action to check if Dolibarr backlink not found on partner website.
__construct($db)
Constructor.
$errors
To return several error codes (or messages)
$error
To return error code (or message)
doCancelStatusOfMemberPartnership()
Action executed by scheduler to cancel status of partnership when subscription is expired + x days.
Class to manage translations.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0)
Add a delay to a date.
Definition date.lib.php:122
dol_string_nospecial($str, $newstr='_', $badcharstoreplace='', $badcharstoremove='', $keepspaces=0)
Clean a string from all punctuation characters to use it as a ref or login.
dol_now($mode='auto')
Return date for now.
getDolGlobalInt($key, $default=0)
Return dolibarr global constant int value.
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $object=null, $include=null)
Return array of possible common substitutions.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
getURLContent($url, $postorget='GET', $param='', $followlocation=1, $addheaders=array(), $allowedschemes=array('http', 'https'), $localurl=0, $ssl_verifypeer=-1)
Function to get a content from an URL (use proxy if proxy defined).