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