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