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