dolibarr 20.0.0
partnershiputils.class.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2021 NextGestion <contact@nextgestion.com>
3 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
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 */
18
25//require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php");
26//require_once(DOL_DOCUMENT_ROOT."/societe/class/societe.class.php");
27require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
28require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
31require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php';
32require_once DOL_DOCUMENT_ROOT.'/partnership/class/partnership.class.php';
33require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php';
34require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php';
35
40{
41 public $db;
42 public $error;
43 public $errors = array();
44
45 public $output; // To store output of some cron methods
46
47
53 public function __construct($db)
54 {
55 $this->db = $db;
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 = (!getDolGlobalString('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 = getDolGlobalString('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((float) $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])) {
122 continue;
123 }
124
125 if ($somethingdoneonpartnership >= $MAXPERCALL) {
126 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);
127 break;
128 }
129
130 $object = new Partnership($this->db);
131 $object->fetch($obj->rowid);
132
133 // Get expiration date
134 $expirationdate = $obj->datefin;
135
136 if ($expirationdate && $expirationdate < $now) { // If contract expired (we already had a test into main select, this is a security)
137 $somethingdoneonpartnership++;
138
139 $result = $object->cancel($user, 0);
140 // $conf->global->noapachereload = null;
141 if ($result < 0) {
142 $error++;
143 $this->error = $object->error;
144 if (is_array($object->errors) && count($object->errors)) {
145 if (is_array($this->errors)) {
146 $this->errors = array_merge($this->errors, $object->errors);
147 } else {
148 $this->errors = $object->errors;
149 }
150 }
151 } else {
152 $partnershipsprocessed[$object->id] = $object->ref;
153
154 // Send an email to inform member
155 $labeltemplate = '('.getDolGlobalString('PARTNERSHIP_SENDMAIL_IF_AUTO_CANCEL', 'SendingEmailOnPartnershipCanceled').')';
156
157 dol_syslog("Now we will send an email to member id=".$object->fk_member." with label ".$labeltemplate);
158
159 // Send deployment email
160 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
161 include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
162 $formmail = new FormMail($this->db);
163
164 // Define output language
165 $outputlangs = $langs;
166 $newlang = '';
167 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
168 $newlang = GETPOST('lang_id', 'aZ09');
169 }
170 if (!empty($newlang)) {
171 $outputlangs = new Translate("", $conf);
172 $outputlangs->setDefaultLang($newlang);
173 $outputlangs->loadLangs(array('main', 'member', 'partnership'));
174 }
175
176 $arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'partnership_send', $user, $outputlangs, 0, 1, $labeltemplate);
177
178 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
179 complete_substitutions_array($substitutionarray, $outputlangs, $object);
180
181 $subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs);
182 $msg = make_substitutions($arraydefaultmessage->content, $substitutionarray, $outputlangs);
183 $from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
184
185 // We are in the case of autocancellation subscription because of missing backlink
186 $fk_partner = $object->fk_member;
187
188 $adherent = new Adherent($this->db);
189 $adherent->fetch($object->fk_member);
190 $sendto = $adherent->email;
191
192 $trackid = 'par'.$object->id;
193 $sendcontext = 'standard';
194
195 $cmail = new CMailFile($subject, $sendto, $from, $msg, array(), array(), array(), '', '', 0, 1, '', '', $trackid, '', $sendcontext);
196
197 $result = $cmail->sendfile();
198
199 if (!$result || !empty($cmail->error) || !empty($cmail->errors)) {
200 $erroremail .= ($erroremail ? ', ' : '').$cmail->error;
201 $this->errors[] = $cmail->error;
202 if (is_array($cmail->errors) && count($cmail->errors) > 0) {
203 $this->errors += $cmail->errors;
204 }
205 } else {
206 // Initialisation of datas of object to call trigger
207 if (is_object($object)) {
208 $actiontypecode = 'AC_OTH_AUTO'; // Event insert into agenda automatically
209 $attachedfiles = array();
210
211 $object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
212 $object->actionmsg = $arraydefaultmessage->topic."\n".$arraydefaultmessage->content; // Long text
213 $object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref);
214 ; // Short text ($langs->transnoentities('MailSentByTo')...);
215 if (getDolGlobalString('MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT')) {
216 $object->actionmsg2 = $subject; // Short text
217 }
218
219 $object->trackid = $trackid;
220 $object->fk_element = $object->id;
221 $object->elementtype = $object->element;
222 if (is_array($attachedfiles) && count($attachedfiles) > 0) {
223 $object->attachedfiles = $attachedfiles;
224 }
225
226 $object->email_from = $from;
227 $object->email_subject = $subject;
228 $object->email_to = $sendto;
229 $object->email_subject = $subject;
230
231 $triggersendname = 'PARTNERSHIP_SENTBYMAIL';
232 // Call of triggers (you should have set $triggersendname to execute trigger)
233 if (!empty($triggersendname)) {
234 $result = $object->call_trigger($triggersendname, $user);
235 if ($result < 0) {
236 $error++;
237 }
238 }
239 // End call of triggers
240 }
241 }
242 }
243 }
244 }
245 }
246 } else {
247 $error++;
248 $this->error = $this->db->lasterror();
249 }
250
251 if (!$error) {
252 $this->db->commit();
253 $this->output = $numofexpiredmembers.' expired partnership members found'."\n";
254 if ($erroremail) {
255 $this->output .= '. Got errors when sending some email : '.$erroremail;
256 }
257 } else {
258 $this->db->rollback();
259 $this->output = "Rollback after error\n";
260 $this->output .= $numofexpiredmembers.' expired partnership members found'."\n";
261 if ($erroremail) {
262 $this->output .= '. Got errors when sending some email : '.$erroremail;
263 }
264 }
265
266 return ($error ? 1 : 0);
267 }
268
269
279 {
280 global $conf, $langs, $user;
281
282 $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR');
283
284 $partnership = new Partnership($this->db);
285 if (empty($maxpercall)) {
286 $maxpercall = getDolGlobalInt('PARTNERSHIP_MAX_WARNING_BACKLINK_PER_CALL', 10);
287 }
288
289 $langs->loadLangs(array("partnership", "member"));
290
291 $error = 0;
292 $erroremail = '';
293 $this->output = '';
294 $this->error = '';
295 $partnershipsprocessed = array();
296 $emailnotfound = '';
297 $websitenotfound = '';
298
299 /*$gracedelay = getDolGlobalInt('PARTNERSHIP_NBDAYS_AFTER_MEMBER_EXPIRATION_BEFORE_CANCEL');
300 if ($gracedelay < 1) {
301 $this->error = 'BadValueForDelayBeforeCancelCheckSetup';
302 return -1;
303 }*/
304
305 $fk_partner = ($managedfor == 'member') ? 'fk_member' : 'fk_soc';
306
307 dol_syslog(get_class($this)."::doWarningOfPartnershipIfDolibarrBacklinkNotfound Warning of partnership");
308
309 $now = dol_now();
310 //$datetotest = dol_time_plus_duree($now, -1 * abs($gracedelay), 'd');
311
312 $this->db->begin();
313
314 $sql = "SELECT p.rowid, p.status, p.".$fk_partner;
315 $sql .= ", p.url_to_check, p.last_check_backlink";
316 $sql .= ', partner.url, partner.email';
317 $sql .= " FROM ".MAIN_DB_PREFIX."partnership as p";
318 if ($managedfor == 'member') {
319 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as partner on (partner.rowid = p.fk_member)";
320 } else {
321 $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as partner on (partner.rowid = p.fk_soc)";
322 }
323 $sql .= " WHERE p.".$fk_partner." > 0";
324 $sql .= " AND p.status = ".((int) $partnership::STATUS_APPROVED); // Only accepted and not yet canceled
325 $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 referral link.
326 $sql .= $this->db->order('p.rowid', 'ASC');
327 // Limit is managed into loop later
328
329 $resql = $this->db->query($sql);
330 if ($resql) {
331 $numofexpiredmembers = $this->db->num_rows($resql);
332 $somethingdoneonpartnership = 0;
333 $ifetchpartner = 0;
334 while ($ifetchpartner < $numofexpiredmembers) {
335 $ifetchpartner++;
336
337 $obj = $this->db->fetch_object($resql);
338 if ($obj) {
339 if (!empty($partnershipsprocessed[$obj->rowid])) {
340 continue;
341 }
342
343 if ($somethingdoneonpartnership >= $maxpercall) {
344 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);
345 break;
346 }
347
348 $backlinkfound = 0;
349
350 $object = new Partnership($this->db);
351 $object->fetch($obj->rowid);
352
353 if ($managedfor == 'member') {
354 $fk_partner = $object->fk_member;
355 } else {
356 $fk_partner = $object->fk_soc;
357 }
358
359 $website = (empty($obj->url_to_check) ? $obj->url : $obj->url_to_check);
360
361 if (empty($website)) {
362 $websitenotfound .= ($websitenotfound ? ', ' : '').'Website not found for id="'.$fk_partner.'"'."\n";
363 } else {
364 $backlinkfound = $this->checkDolibarrBacklink($website);
365 }
366
367 if (!$backlinkfound) {
368 $tmpcount = $object->count_last_url_check_error + 1;
369
370 $nbminbacklinkerrorforcancel = (int) getDolGlobalString('PARTNERSHIP_MIN_BACKLINK_ERROR_FOR_CANCEL', 3);
371 $nbmaxbacklinkerrorforcancel = (int) getDolGlobalString('PARTNERSHIP_MAX_BACKLINK_ERROR_FOR_CANCEL', (int) $nbminbacklinkerrorforcancel + 2);
372
373 // If $nbminbacklinkerrorforemail = 0, no autoemail
374 if ($nbminbacklinkerrorforcancel > 0) {
375 if ($tmpcount > $nbminbacklinkerrorforcancel && $tmpcount <= $nbmaxbacklinkerrorforcancel) { // Send Warning Email
376 if (!empty($obj->email)) {
377 $emailnotfound .= ($emailnotfound ? ', ' : '').'Email not found for id="'.$fk_partner.'"'."\n";
378 } else {
379 // Example: 'SendingEmailOnPartnershipWillSoonBeCanceled'
380 $labeltemplate = '('.getDolGlobalString('PARTNERSHIP_SENDMAIL_IF_NO_LINK', 'SendingEmailOnPartnershipWillSoonBeCanceled').')';
381
382 dol_syslog("Now we will send an email to partner id=".$fk_partner." with label ".$labeltemplate);
383
384 // Send deployment email
385 include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
386 include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
387 $formmail = new FormMail($this->db);
388
389 // Define output language
390 $outputlangs = $langs;
391 $newlang = '';
392 if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) {
393 $newlang = GETPOST('lang_id', 'aZ09');
394 }
395 if (!empty($newlang)) {
396 $outputlangs = new Translate("", $conf);
397 $outputlangs->setDefaultLang($newlang);
398 $outputlangs->loadLangs(array('main', 'member', 'partnership'));
399 }
400
401 $arraydefaultmessage = $formmail->getEMailTemplate($this->db, 'partnership_send', $user, $outputlangs, 0, 1, $labeltemplate);
402
403 $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
404 complete_substitutions_array($substitutionarray, $outputlangs, $object);
405
406 $subject = make_substitutions($arraydefaultmessage->topic, $substitutionarray, $outputlangs);
407 $msg = make_substitutions($arraydefaultmessage->content, $substitutionarray, $outputlangs);
408 $from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <' . getDolGlobalString('MAIN_INFO_SOCIETE_MAIL').'>';
409
410 $sendto = $obj->email;
411
412 $trackid = 'par'.$object->id;
413 $sendcontext = 'standard';
414
415 $cmail = new CMailFile($subject, $sendto, $from, $msg, array(), array(), array(), '', '', 0, 1, '', '', $trackid, '', $sendcontext);
416
417 $result = $cmail->sendfile();
418
419 if (!$result || !empty($cmail->error) || !empty($cmail->errors)) {
420 $erroremail .= ($erroremail ? ', ' : '').$cmail->error;
421 $this->errors[] = $cmail->error;
422 if (is_array($cmail->errors) && count($cmail->errors) > 0) {
423 $this->errors += $cmail->errors;
424 }
425 } else {
426 // Initialisation of datas of object to call trigger
427 if (is_object($object)) {
428 $actiontypecode = 'AC_OTH_AUTO'; // Event insert into agenda automatically
429 $attachedfiles = array();
430
431 if ($managedfor != 'member') {
432 $object->socid = $fk_partner; // To link to a company
433 }
434 $object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...)
435 $object->actionmsg = $arraydefaultmessage->topic."\n".$arraydefaultmessage->content; // Long text
436 $object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref);
437 ; // Short text ($langs->transnoentities('MailSentByTo')...);
438 if (getDolGlobalString('MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT')) {
439 $object->actionmsg2 = $subject; // Short text
440 }
441
442 $object->trackid = $trackid;
443 $object->fk_element = $object->id;
444 $object->elementtype = $object->element;
445 if (is_array($attachedfiles) && count($attachedfiles) > 0) {
446 $object->attachedfiles = $attachedfiles;
447 }
448
449 $object->email_from = $from;
450 $object->email_subject = $subject;
451 $object->email_to = $sendto;
452 $object->email_subject = $subject;
453
454 $triggersendname = 'PARTNERSHIP_SENTBYMAIL';
455 // Call of triggers (you should have set $triggersendname to execute trigger)
456 if (!empty($triggersendname)) {
457 $result = $object->call_trigger($triggersendname, $user);
458 if ($result < 0) {
459 $error++;
460 }
461 }
462 // End call of triggers
463 }
464 }
465 }
466 } elseif ($tmpcount > $nbmaxbacklinkerrorforcancel) { // Cancel Partnership
467 $object->status = $object::STATUS_CANCELED;
468 $object->reason_decline_or_cancel = $langs->trans('BacklinkNotFoundOnPartnerWebsite');
469 }
470 }
471
472 $object->count_last_url_check_error = $tmpcount;
473 } else {
474 $object->count_last_url_check_error = 0;
475 $object->reason_decline_or_cancel = '';
476 }
477
478 $partnershipsprocessed[$object->id] = $object->ref;
479
480 $object->last_check_backlink = $now;
481
482 $object->update($user);
483 }
484 }
485 } else {
486 $error++;
487 $this->error = $this->db->lasterror();
488 }
489
490 if (!$error) {
491 $this->db->commit();
492 $this->output = "";
493 } else {
494 $this->db->rollback();
495 $this->output = "Rollback after error\n";
496 }
497 $this->output .= $numofexpiredmembers.' partnership checked'."\n";
498 if ($erroremail) {
499 $this->output .= '. Got errors when sending some email : '.$erroremail."\n";
500 }
501 if ($emailnotfound) {
502 $this->output .= '. Email not found for some partner : '.$emailnotfound."\n";
503 }
504 if ($websitenotfound) {
505 $this->output .= '. Website not found for some partner : '.$websitenotfound."\n";
506 }
507 $this->output .= "\nSQL used to find partnerships to scan: ".$sql;
508
509 return ($error ? 1 : 0);
510 }
511
518 private function checkDolibarrBacklink($website = null)
519 {
520 global $conf;
521
522 $found = 0;
523 $error = 0;
524 $webcontent = '';
525
526 // $website = 'https://nextgestion.com/'; // For Test
527 $tmpgeturl = getURLContent($website, 'GET', '', 1, array(), array('http', 'https'), 0);
528 if ($tmpgeturl['curl_error_no']) {
529 $error++;
530 dol_syslog('Error getting '.$website.': '.$tmpgeturl['curl_error_msg']);
531 } elseif ($tmpgeturl['http_code'] != '200') {
532 $error++;
533 dol_syslog('Error getting '.$website.': '.$tmpgeturl['curl_error_msg']);
534 } else {
535 $urlContent = $tmpgeturl['content'];
536 $dom = new DOMDocument();
537 @$dom->loadHTML($urlContent);
538
539 $xpath = new DOMXPath($dom);
540 $hrefs = $xpath->evaluate("//a");
541
542 for ($i = 0; $i < $hrefs->length; $i++) {
543 $href = $hrefs->item($i);
544 $url = $href->getAttribute('href');
545 $url = filter_var($url, FILTER_SANITIZE_URL);
546 if (!filter_var($url, FILTER_VALIDATE_URL) === false) {
547 $webcontent .= $url;
548 }
549 }
550 }
551
552 if ($webcontent && getDolGlobalString('PARTNERSHIP_BACKLINKS_TO_CHECK') && preg_match('/' . getDolGlobalString('PARTNERSHIP_BACKLINKS_TO_CHECK').'/', $webcontent)) {
553 $found = 1;
554 }
555
556 return $found;
557 }
558}
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:58
Class to manage members of a foundation.
Class to send emails (with attachments or not) Usage: $mailfile = new CMailFile($subject,...
Class permettant la generation du formulaire html d'envoi de mail unitaire Usage: $formail = new Form...
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:124
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 a 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).