dolibarr 25.0.0-alpha
xcal.lib.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2024-2026 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
19
36function build_calfile($format, $title, $desc, $events_array, $outputfile)
37{
38 dol_syslog("xcal.lib.php::build_calfile Build cal file ".$outputfile." to format ".$format);
39
40 if (empty($outputfile)) {
41 // -1 = error
42 return -1;
43 }
44
45 $nbevents = 0;
46
47 // Note: A cal file is an UTF8 encoded file
48 $calfileh = fopen($outputfile, "w");
49
50 if ($calfileh) {
51 include_once DOL_DOCUMENT_ROOT."/core/lib/date.lib.php";
52
53 $now = dol_now();
54 $encoding = "";
55
56 // A line of a calendar file ends with CRLF (RFC 5545 section 3.1). An iCal line is folded at 75 octets, and the control
57 // characters of a value (a line break in an uid, an url or an email) are removed so they can not add a property.
59 $writeline = function ($line) use ($calfileh, $format) {
60 if ($format === "ical") {
61 $line = calFoldLine((string) preg_replace('/[\x00-\x08\x0A-\x1F\x7F]+/', ' ', $line));
62 }
63 fwrite($calfileh, $line."\r\n");
64 };
65
66 if ($format === "vcal") {
67 $encoding = "ENCODING=QUOTED-PRINTABLE:";
68 }
69
70 // Print header
71 $writeline("BEGIN:VCALENDAR");
72
73 // version is always "2.0"
74 $writeline("VERSION:2.0");
75
76 $writeline("METHOD:PUBLISH");
77 $writeline("PRODID:-//DOLIBARR ".DOL_VERSION);
78 $writeline("CALSCALE:GREGORIAN");
79 $writeline("X-WR-CALNAME:".$encoding.format_cal($format, $title));
80 $writeline("X-WR-CALDESC:".$encoding.format_cal($format, $desc));
81 //fwrite($calfileh,"X-WR-TIMEZONE:Europe/Paris\n");
82
83 if (getDolGlobalString('MAIN_AGENDA_EXPORT_CACHE') && getDolGlobalInt('MAIN_AGENDA_EXPORT_CACHE') > 60) {
84 $ttl = getDolGlobalInt('MAIN_AGENDA_EXPORT_CACHE');
85
86 $writeline("X-PUBLISHED-TTL:PT".intdiv($ttl, 3600)."H".intdiv($ttl % 3600, 60)."M".($ttl % 60)."S");
87 }
88
89 foreach ($events_array as $key => $event) {
90 // See http://fr.wikipedia.org/wiki/ICalendar for format
91 // See http://www.ietf.org/rfc/rfc2445.txt for RFC
92
93 // TODO: avoid use extra event array, use objects direct thahtwas created before
94
95 $uid = $event["uid"];
96 $type = $event["type"];
97 $startdate = $event["startdate"];
98 $duration = $event["duration"];
99 $enddate = $event["enddate"];
100 $summary = $event["summary"];
101 $category = $event["category"];
102 $priority = $event["priority"];
103 $fulldayevent = $event["fulldayevent"];
104 $location = $event["location"];
105 $email = $event["email"];
106 $url = $event["url"];
107 $transparency = $event["transparency"];
108 $description = dol_string_nohtmltag(preg_replace("/<br[\s\/]?>/i", "\n", $event["desc"]), 0);
109 $created = $event["created"];
110 $modified = $event["modified"];
111 $assignedUsers = $event["assignedUsers"] ?? array();
112 //print $fulldayevent.' '.dol_print_date($startdate, 'dayhour', 'gmt');
113
114 // Format
115 $summary = format_cal($format, $summary);
116 $description = format_cal($format, $description);
117 $category = format_cal($format, (string) $category);
118 $location = format_cal($format, (string) $location);
119
120 // Output the vCard/iCal VEVENT object
121 /*
122 Example from Google ical export for a 1 hour event:
123 BEGIN:VEVENT
124 DTSTART:20101103T120000Z
125 DTEND:20101103T130000Z
126 DTSTAMP:20101121T144902Z
127 UID:4eilllcsq8r1p87ncg7vc8dbpk@google.com
128 CREATED:20101121T144657Z
129 DESCRIPTION:
130 LAST-MODIFIED:20101121T144707Z
131 LOCATION:
132 SEQUENCE:0
133 STATUS:CONFIRMED
134 SUMMARY:Task 1 hour
135 TRANSP:OPAQUE
136 END:VEVENT
137
138 Example from Google ical export for a 1 day event:
139 BEGIN:VEVENT
140 DTSTART;VALUE=DATE:20101102
141 DTEND;VALUE=DATE:20101103
142 DTSTAMP:20101121T144902Z
143 UID:d09t43kcf1qgapu9efsmmo1m6k@google.com
144 CREATED:20101121T144607Z
145 DESCRIPTION:
146 LAST-MODIFIED:20101121T144607Z
147 LOCATION:
148 SEQUENCE:0
149 STATUS:CONFIRMED
150 SUMMARY:Task 1 day
151 TRANSP:TRANSPARENT
152 END:VEVENT
153 */
154
155 if ($type === "event") {
156 $nbevents++;
157
158 $writeline("BEGIN:VEVENT");
159 $writeline("UID:".$uid);
160
161 if (!empty($email)) {
162 $writeline("ORGANIZER:MAILTO:".$email);
163 $writeline("CONTACT:MAILTO:".$email);
164 }
165
166 if (!empty($url)) {
167 $writeline("URL:".$url);
168 }
169
170 if (is_array($assignedUsers)) {
171 foreach ($assignedUsers as $assignedUser) {
172 if (empty($assignedUser->email) || $assignedUser->email === $email) {
173 continue;
174 }
175
176 $writeline("ATTENDEE;RSVP=TRUE:mailto:".$assignedUser->email);
177 }
178 }
179
180 if ($created) {
181 $writeline("CREATED:".dol_print_date($created, "dayhourxcard", true));
182 }
183
184 if ($modified) {
185 $writeline("LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", true));
186 }
187
188 $writeline("SUMMARY:".$encoding.$summary);
189 $writeline("DESCRIPTION:".$encoding.$description);
190
191 if (!empty($location)) {
192 $writeline("LOCATION:".$encoding.$location);
193 }
194
195 if ($fulldayevent) {
196 $writeline("X-FUNAMBOL-ALLDAY:1");
197 }
198
199 // see https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/0f262da6-c5fd-459e-9f18-145eba86b5d2
200 if ($fulldayevent) {
201 $writeline("X-MICROSOFT-CDO-ALLDAYEVENT:TRUE");
202 }
203
204 // Date must be GMT dates
205 // Current date
206 $writeline("DTSTAMP:".dol_print_date($now, "dayhourxcard", 'gmt'));
207
208 // Start date
209 $prefix = "";
210 $startdatef = dol_print_date($startdate, "dayhourxcard", 'gmt');
211
212 if ($fulldayevent) {
213 // For fullday event, date was stored with old version by using the user timezone instead of storing the date at UTC+0
214 // in the timezone of server (so for a PHP timezone of -3, we should store '2023-05-31 21:00:00.000'
215 // Using option MAIN_STORE_FULL_EVENT_IN_GMT=1 change the behaviour to store in GMT for full day event. This must become
216 // the default behaviour but there is no way to change keeping old saved date compatible.
217 $tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
218 // Local time should be used to prevent users in time zones earlier than GMT from being one day earlier
219 $prefix = ";VALUE=DATE";
220 if ($tzforfullday) {
221 $startdatef = dol_print_date($startdate, "dayxcard", 'gmt');
222 } else {
223 $startdatef = dol_print_date($startdate, "dayxcard", 'tzserver');
224 }
225 }
226
227 $writeline("DTSTART".$prefix.":".$startdatef);
228
229 // End date
230 if ($fulldayevent) {
231 if (empty($enddate)) {
232 // We add 1 day needed for full day event (DTEND must be next day after event).
233 // This is mention in https://datatracker.ietf.org/doc/html/rfc5545:
234 // "The "DTEND" property for a "VEVENT" calendar component specifies the non-inclusive end of the event."
235 $enddate = dol_time_plus_duree($startdate, 1, "d");
236 }
237 } else {
238 if (empty($enddate)) {
239 $enddate = $startdate + $duration;
240 }
241 }
242
243 $prefix = "";
244 $enddatef = dol_print_date($enddate, "dayhourxcard", 'gmt');
245
246 if ($fulldayevent) {
247 $prefix = ";VALUE=DATE";
248 // We add 1 second so we reach the +1 day needed for full day event (DTEND must be next day after event)
249 // This is mention in https://datatracker.ietf.org/doc/html/rfc5545:
250 // "The "DTEND" property for a "VEVENT" calendar component specifies the non-inclusive end of the event."
251 $enddatef = dol_print_date($enddate + 1, "dayxcard", 'tzserver');
252 }
253
254 $writeline("DTEND".$prefix.":".$enddatef);
255 $writeline("STATUS:CONFIRMED");
256
257 if (!empty($transparency)) {
258 $writeline("TRANSP:".$transparency);
259 }
260
261 if (!empty($category)) {
262 $writeline("CATEGORIES:".$encoding.$category);
263 }
264
265 $writeline("END:VEVENT");
266 }
267
268 // Output the vCard/iCal VJOURNAL object
269 if ($type === "journal") {
270 $nbevents++;
271
272 $writeline("BEGIN:VJOURNAL");
273 $writeline("UID:".$uid);
274
275 if (!empty($email)) {
276 $writeline("ORGANIZER:MAILTO:".$email);
277 $writeline("CONTACT:MAILTO:".$email);
278 }
279
280 if (!empty($url)) {
281 $writeline("URL:".$url);
282 }
283
284 if ($created) {
285 $writeline("CREATED:".dol_print_date($created, "dayhourxcard", 'gmt'));
286 }
287
288 if ($modified) {
289 $writeline("LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", 'gmt'));
290 }
291
292 $writeline("SUMMARY:".$encoding.$summary);
293 $writeline("DESCRIPTION:".$encoding.$description);
294 $writeline("STATUS:CONFIRMED");
295 if (!empty($category)) {
296 $writeline("CATEGORIES:".$encoding.$category);
297 }
298 if (!empty($location)) {
299 $writeline("LOCATION:".$encoding.$location);
300 }
301 $writeline("TRANSP:OPAQUE");
302 $writeline("CLASS:CONFIDENTIAL");
303 $writeline("DTSTAMP:".dol_print_date($now, "dayhourxcard", 'gmt'));
304
305 $writeline("END:VJOURNAL");
306 }
307 }
308
309 // Footer
310 $writeline("END:VCALENDAR");
311
312 fclose($calfileh);
313 dolChmod($outputfile);
314 } else {
315 dol_syslog("xcal.lib.php::build_calfile Failed to open file ".$outputfile." for writing");
316 return -2;
317 }
318
319 return $nbevents;
320}
321
337function build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter = '', $url = '', $langcode = '', $useurlforguid = false)
338{
339 global $langs, $mysoc;
341
342 dol_syslog("xcal.lib.php::build_rssfile Build rss file ".$outputfile." to format ".$format);
343
344 if (empty($outputfile)) {
345 // -1 = error
346 return -1;
347 }
348
349 $nbevents = 0;
350
351 $fichier = fopen($outputfile, "w");
352
353 if ($fichier) {
354 // Print header
355 fwrite($fichier, '<?xml version="1.0" encoding="'.$langs->charset_output.'"?>'."\n");
356
357 //fwrite($fichier, '<rss version="2.0">'."\n");
358 fwrite($fichier, '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">'."\n"); // xmlns:atom is required to be valid by parser (Publer RSS reader) for example.
359
360 fwrite($fichier, "<channel>\n");
361 fwrite($fichier, "<title>".dol_escape_xml($title)."</title>\n");
362 fwrite($fichier, "<description>".dol_escape_xml($title)."</description>\n");
363 if ($langcode) {
364 fwrite($fichier, "<language>".dol_escape_xml($langcode)."</language>\n");
365 }
366
367 // Define $urlwithroot
368 $urlwithouturlroot = preg_replace("/".preg_quote(DOL_URL_ROOT, "/")."$/i", "", trim($dolibarr_main_url_root));
369 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
370 //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
371
372 // Url
373 if (empty($url)) {
374 $url = $urlwithroot."/public/agenda/agendaexport.php?format=rss&exportkey=".urlencode(getDolGlobalString('MAIN_AGENDA_XCAL_EXPORTKEY'));
375 }
376 //fwrite($fichier, "<link><![CDATA[".$url."]]></link>\n");
377 include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
378 fwrite($fichier, "<link>".rssUrl(getRootURLFromURL($url))."</link>\n");
379
380 // Image
381 if (!empty($mysoc->logo_squarred_small)) {
382 $urlimage = $urlwithroot.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_small);
383 //$urlimage = $GLOBALS['website']->virtualhost
384 if ($urlimage && (empty($GLOBALS['website']) || preg_match('/'.preg_quote($GLOBALS['website']->virtualhost, '/').'/', $urlwithroot))) {
385 fwrite($fichier, "<image><url>".rssCdata($urlimage)."</url><title>".dol_escape_xml($title)."</title><link>".rssCdata($url)."</link></image>\n");
386 }
387 }
388
389 // Add a tag for some readers (Google / Feed readers) to detect that this is a RSS feed and not a generic XML file
390 // For Atom link, the & must be &amp; instead of &.
391 fwrite($fichier, '<atom:link href="'.rssUrl($url).'" rel="self" type="application/rss+xml"/>'."\n");
392
393 foreach ($events_array as $key => $event) {
394 $eventqualified = true;
395
396 if ($filter) {
397 // TODO Add a filter
398
399 $eventqualified = false;
400 }
401
402 if ($eventqualified) {
403 $nbevents++;
404
405 if (is_object($event) && get_class($event) == 'WebsitePage') {
406 // Convert object WebsitePage into an array $event
407 $tmpevent = array();
408 $tmpevent['uid'] = (string) $event->id;
409 $tmpevent['startdate'] = $event->date_creation;
410 $tmpevent['summary'] = $event->title;
411 $tmpevent['url'] = $event->fullpageurl ? $event->fullpageurl : $event->pageurl.'.php';
412 $tmpevent['author'] = $event->author_alias ? $event->author_alias : 'unknown';
413 //$tmpevent['category'] = '';
414 $tmpevent['desc'] = $event->description;
415 if (!empty($event->image)) {
416 $tmpevent['image'] = $GLOBALS['website']->virtualhost.'/medias/'.$event->image;
417 } else {
418 include_once DOL_DOCUMENT_ROOT.'/core/lib/website.lib.php';
419 $tmpimage = getImageFromHtmlContent($event->content);
420 if ($tmpimage) {
421 if (strpos($tmpimage, '/') === 0) { // If $tmpimage is an absolute path
422 $tmpevent['image'] = $GLOBALS['website']->virtualhost.$tmpimage;
423 } elseif (stripos($tmpimage, 'http') === 0) { // If $tmpimage is a full URI
424 $tmpevent['image'] = $tmpimage;
425 } else {
426 $tmpevent['image'] = $GLOBALS['website']->virtualhost.'/medias/'.$tmpimage;
427 } // TODO If $tmpimage is "data:..."
428 }
429 }
430 $tmpevent['content'] = $event->content;
431
432 $event = $tmpevent;
433 }
434 $uid = $event["uid"];
435 $startdate = $event["startdate"];
436 $summary = $event["summary"];
437 $description = $event["desc"];
438 $url = empty($event["url"]) ? '' : $event["url"];
439 $author = $event["author"];
440 $category = empty($event["category"]) ? null : $event["category"];
441 $image = '';
442 if (!empty($event["image"])) {
443 $image = $event["image"];
444 } else {
445 $reg = array();
446 // If we found a link into content like <img alt="..." class="..." src="..."
447 if (!empty($event["content"]) && preg_match('/<img\s*(?:alt="[^"]*"\s*)?(?:class="[^"]*"\s*)?src="([^"]+)"/m', $event["content"], $reg)) {
448 if (!empty($reg[0])) {
449 $image = $reg[1];
450 }
451 // Convert image "/medias/...." and "/viewimage.php?modulepart=medias&file=(.*)"
452 if (!empty($GLOBALS['website']->virtualhost)) {
453 if (preg_match('/^\/medias\//', $image)) {
454 $image = $GLOBALS['website']->virtualhost.$image;
455 } elseif (preg_match('/^\/viewimage\.php\?modulepart=medias&[^"]*file=([^&"]+)/', $image, $reg)) {
456 $image = $GLOBALS['website']->virtualhost.'/medias/'.$reg[1];
457 }
458 }
459 }
460 }
461
462
463 /* No place inside a RSS
464 $priority = $event["priority"];
465 $fulldayevent = $event["fulldayevent"];
466 $location = $event["location"];
467 $email = $event["email"];
468 */
469
470 $description = dol_string_nohtmltag(preg_replace("/<br[\s\/]?>/i", "\n", $event["desc"]), 0);
471
472 fwrite($fichier, "<item>\n");
473 fwrite($fichier, "<title>".rssCdata($summary)."</title>\n");
474 //fwrite($fichier, "<link><![CDATA[".$url."]]></link>\n");
475 fwrite($fichier, "<link>".rssUrl($url)."</link>\n");
476
477 //fwrite($fichier, "<author><![CDATA[".$author."]]></author>\n");
478 if (!empty($category)) {
479 fwrite($fichier, "<category>".rssCdata($category)."</category>\n");
480 }
481 //fwrite($fichier, "<description><![CDATA[".$summary."]]></description>\n");
482 $descriptionhtml = '';
483 if (!empty($image)) {
484 $descriptionhtml .= '<p><img class="center" src="'.htmlspecialchars($image, ENT_QUOTES).'"/></p>';
485 }
486 if ($description) {
487 $descriptionhtml .= $description;
488 }
489 fwrite($fichier, "<description>".rssCdata($descriptionhtml)."</description>\n");
490 // Note: We may also add description into content:encoded tag.
491
492 fwrite($fichier, "<pubDate>".date("r", $startdate)."</pubDate>\n");
493 if ($useurlforguid) {
494 fwrite($fichier, '<guid isPermaLink="true">'.rssUrl($url).'</guid>'."\n");
495 } else {
496 fwrite($fichier, '<guid isPermaLink="false">'.rssCdata(str_pad($uid, 10, "0", STR_PAD_LEFT)).'</guid>'."\n");
497 }
498 fwrite($fichier, '<source url="'.rssUrl($url).'"><![CDATA[Dolibarr]]></source>'."\n");
499 fwrite($fichier, "</item>\n");
500 }
501 }
502
503 fwrite($fichier, "</channel>");
504 fwrite($fichier, "\n");
505 fwrite($fichier, "</rss>");
506
507 fclose($fichier);
508 dolChmod($outputfile);
509 }
510
511 return $nbevents;
512}
513
522function rssCdata($string)
523{
524 $string = (string) preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F]/', '', $string);
525
526 return '<![CDATA['.str_replace(']]>', ']]]]><![CDATA[>', $string).']]>';
527}
528
536function rssUrl($url)
537{
538 $url = (string) preg_replace('/[\x00-\x1F\x7F]/', '', $url);
539 $url = (string) preg_replace('/&(?!amp;|lt;|gt;|quot;|apos;)/', '&amp;', $url);
540
541 return str_replace(array('"', "'", '<', '>'), array('&quot;', '&apos;', '&lt;', '&gt;'), $url);
542}
543
551function format_cal($format, $string)
552{
553 $newstring = $string;
554
555 if ($format === "vcal") {
556 $newstring = quotedPrintEncode($newstring);
557 }
558
559 if ($format === "ical") {
560 // Escape a TEXT value as RFC 5545 section 3.3.11: backslash, semicolon, comma and new lines.
561 // The line is folded at 75 octets when it is written (see calFoldLine()).
562 $newstring = str_replace(array("\\", ";", ",", "\r\n", "\n\r", "\r", "\n"), array("\\\\", "\\;", "\\,", "\\n", "\\n", "\\n", "\\n"), $newstring);
563 }
564
565 return $newstring;
566}
567
575function calFoldLine($line)
576{
577 $out = "";
578 while (strlen($line) > 75) {
579 $cut = 75;
580 while ($cut > 0 && (ord($line[$cut]) & 0xC0) == 0x80) { // Do not cut in the middle of a UTF-8 character
581 $cut--;
582 }
583 $out .= substr($line, 0, $cut)."\r\n";
584 $line = " ".substr($line, $cut);
585 }
586
587 return $out.$line;
588}
589
598function calEncode($line)
599{
600 $out = "";
601 $newpara = "";
602
603 // If mb_ functions exists, it"s better to use them
604 if (function_exists("mb_strlen")) {
605 $strlength = mb_strlen($line, "UTF-8");
606
607 for ($j = 0; $j < $strlength; $j++) {
608 // Take char at position $j
609 $char = dol_substr($line, $j, 1, "UTF-8");
610
611 if ((mb_strlen($newpara, "UTF-8") + mb_strlen($char, "UTF-8")) >= 75) {
612 // CRLF + Space for cal
613 $out .= $newpara."\r\n ";
614
615 $newpara = "";
616 }
617
618 $newpara .= $char;
619 }
620
621 $out .= $newpara;
622 } else {
623 $strlength = dol_strlen($line);
624
625 for ($j = 0; $j < $strlength; $j++) {
626 // Take char at position $j
627 $char = substr($line, $j, 1);
628
629 if ((dol_strlen($newpara) + dol_strlen($char)) >= 75) {
630 // CRLF + Space for cal
631 $out .= $newpara."\r\n ";
632
633 $newpara = "";
634 }
635
636 $newpara .= $char;
637 }
638
639 $out .= $newpara;
640 }
641
642 return trim($out);
643}
644
645
653function quotedPrintEncode($str, $forcal = 0)
654{
655 $lines = preg_split("/\r\n/", $str);
656 $out = "";
657
658 foreach ($lines as $line) {
659 $newpara = "";
660
661 // Do not use dol_strlen here, we need number of bytes
662 $strlength = strlen($line);
663
664 for ($j = 0; $j < $strlength; $j++) {
665 $char = substr($line, $j, 1);
666 $ascii = ord($char);
667
668 if ($ascii < 32 || $ascii === 61 || $ascii > 126) {
669 $char = "=".strtoupper(sprintf("%02X", $ascii));
670 }
671
672 // Do not use dol_strlen here, we need number of bytes
673 if ((strlen($newpara) + strlen($char)) >= 76) {
674 // New line with carray-return (CR) and line-feed (LF)
675 $out .= $newpara."=\r\n";
676
677 // extra space for cal
678 if ($forcal) {
679 $out .= " ";
680 }
681
682 $newpara = "";
683 }
684
685 $newpara .= $char;
686 }
687
688 $out .= $newpara;
689 }
690 return trim($out);
691}
692
699function quotedPrintDecode($str)
700{
701 return trim(quoted_printable_decode(preg_replace("/=\r?\n/", "", $str)));
702}
global $dolibarr_main_url_root
global $mysoc
getImageFromHtmlContent($htmlContent, $imageNumber=1)
Return the URL of an image found into a HTML content.
dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth=0, $tz='')
Add a delay to a date.
Definition date.lib.php:127
dol_now($mode='gmt')
Return date for now.
dol_strlen($string, $stringencoding='UTF-8', $binarycount=0)
Make a strlen call.
dol_string_nohtmltag($stringtoclean, $removelinefeed=1, $pagecodeto='UTF-8', $strip_tags=0, $removedoublespaces=1)
Clean a string from all HTML tags and entities.
dolChmod($filepath, $newmask='')
Change mod of a file.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_substr($string, $start, $length=null, $stringencoding='', $trunconbytes=0)
Make a substring.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
dol_escape_xml($stringtoescape)
Returns text escaped for inclusion into a XML string.
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.
getRootURLFromURL($url)
Function root url from a long url For example: https://www.abc.mydomain.com/dir/page....
print $langs trans('Date')." left Ref Label right Qty right Price right TotalHT right TotalTTC right right right right right right right right right centpercent right TotalHT right n right VAT right n right TotalVAT right n No sujeto a RE IRPF right TotalLT1 right n right TotalLT2 right n right TotalTTC right n takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency takeposcustomercurrency right TotalTTC takeposcustomercurrency right takeposcustomercurrency n right Paid right PaymentTypeShortLIQ right SELECT p pos_change as p datep as date
Definition receipt.php:492
quotedPrintEncode($str, $forcal=0)
Encode into vcal format.
Definition xcal.lib.php:653
build_calfile($format, $title, $desc, $events_array, $outputfile)
Build a file from an array of events All input params and data must be encoded in $conf->charset_outp...
Definition xcal.lib.php:36
build_rssfile($format, $title, $desc, $events_array, $outputfile, $filter='', $url='', $langcode='', $useurlforguid=false)
Build a file from an array of events.
Definition xcal.lib.php:337
rssUrl($url)
Return an URL ready to be written in a XML file, as a text or as an attribute value.
Definition xcal.lib.php:536
calFoldLine($line)
Fold a line of an iCal file as RFC 5545 section 3.1 asks: no more than 75 octets per line,...
Definition xcal.lib.php:575
format_cal($format, $string)
Encode for cal export.
Definition xcal.lib.php:551
calEncode($line)
Cut string after 75 chars.
Definition xcal.lib.php:598
rssCdata($string)
Return a text as a CDATA section of a XML file.
Definition xcal.lib.php:522
quotedPrintDecode($str)
Decode vcal format.
Definition xcal.lib.php:699