diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 0166769660a..ce36d97d06a 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -164,6 +164,9 @@ $urlvcal .= $urlwithroot.'/public/agenda/agendaexport.php?format=vcal'.$getentit $message .= img_picto('', 'globe').' '.str_replace('{url}', $urlvcal, ''.$langs->trans("WebCalUrlForVCalExport", 'vcal', '').''); $message .= ''; $message .= ajax_autoselect('onlinepaymenturl1'); $message .= '
'; @@ -173,6 +176,9 @@ $urlical .= $urlwithroot.'/public/agenda/agendaexport.php?format=ical&type=event $message .= img_picto('', 'globe').' '.str_replace('{url}', $urlical, ''.$langs->trans("WebCalUrlForVCalExport", 'ical/ics', '').''); $message .= ''; $message .= ajax_autoselect('onlinepaymenturl2'); $message .= '
'; @@ -182,6 +188,9 @@ $urlrss .= $urlwithroot.'/public/agenda/agendaexport.php?format=rss'.$getentity. $message .= img_picto('', 'globe').' '.str_replace('{url}', $urlrss, ''.$langs->trans("WebCalUrlForVCalExport", 'rss', '').''); $message .= ''; $message .= ajax_autoselect('onlinepaymenturl3'); $message .= '
'; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 8dd0d9febbe..1e640f7afbe 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1952,14 +1952,14 @@ class ActionComm extends CommonObject $event = array(); $event['uid'] = 'dolibarragenda-'.$this->db->database_name.'-'.$obj->id."@".$_SERVER["SERVER_NAME"]; $event['type'] = $type; + $datestart = $this->db->jdate($obj->datep) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); // fix for -> Warning: A non-numeric value encountered if (is_numeric($this->db->jdate($obj->datep2))) { - $dateend = $this->db->jdate($obj->datep2) - - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); + $dateend = $this->db->jdate($obj->datep2) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); } else { - // use start date as fall-back to avoid import erros on empty end date + // use start date as fall-back to avoid pb with empty end date on ICS readers $dateend = $datestart; } diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php index fcd1660985b..74b5f711da9 100644 --- a/htdocs/core/lib/xcal.lib.php +++ b/htdocs/core/lib/xcal.lib.php @@ -100,6 +100,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) $created = $event["created"]; $modified = $event["modified"]; $assignedUsers = $event["assignedUsers"]; + //print $fulldayevent.' '.dol_print_date($startdate, 'dayhour', 'gmt'); // Format $summary = format_cal($format, $summary); @@ -191,16 +192,16 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) // Date must be GMT dates // Current date - fwrite($calfileh, "DTSTAMP:".dol_print_date($now, "dayhourxcard", true)."\n"); + fwrite($calfileh, "DTSTAMP:".dol_print_date($now, "dayhourxcard", 'gmt')."\n"); // Start date $prefix = ""; - $startdatef = dol_print_date($startdate, "dayhourxcard", true); + $startdatef = dol_print_date($startdate, "dayhourxcard", 'gmt'); if ($fulldayevent) { // Local time $prefix = ";VALUE=DATE"; - $startdatef = dol_print_date($startdate, "dayxcard", false); + $startdatef = dol_print_date($startdate, "dayxcard", 'gmt'); } fwrite($calfileh, "DTSTART".$prefix.":".$startdatef."\n"); @@ -208,7 +209,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) // End date if ($fulldayevent) { if (empty($enddate)) { - $enddate = dol_time_plus_duree($startdate, 1, "d"); + $enddate = dol_time_plus_duree($startdate, 1, "d"); // We add 1 day needed for full day event (DTEND must be next day after event) } } else { if (empty($enddate)) { @@ -217,14 +218,11 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) } $prefix = ""; - $enddatef = dol_print_date($enddate, "dayhourxcard", true); + $enddatef = dol_print_date($enddate, "dayhourxcard", 'gmt'); if ($fulldayevent) { $prefix = ";VALUE=DATE"; - $enddatef = dol_print_date($enddate + 1, "dayxcard", false); - - // Local time - //$enddatef .= dol_print_date($enddate+1,"dayhourxcard",false); + $enddatef = dol_print_date($enddate + 1, "dayxcard", 'gmt'); // We add 1 second so we reach the +1 day needed for full day event (DTEND must be next day after event) } fwrite($calfileh, "DTEND".$prefix.":".$enddatef."\n"); @@ -256,11 +254,11 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) } if ($created) { - fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", true)."\n"); + fwrite($calfileh, "CREATED:".dol_print_date($created, "dayhourxcard", 'gmt')."\n"); } if ($modified) { - fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", true)."\n"); + fwrite($calfileh, "LAST-MODIFIED:".dol_print_date($modified, "dayhourxcard", 'gmt')."\n"); } fwrite($calfileh, "SUMMARY:".$encoding.$summary."\n"); @@ -270,7 +268,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) fwrite($calfileh, "LOCATION:".$location."\n"); fwrite($calfileh, "TRANSP:OPAQUE\n"); fwrite($calfileh, "CLASS:CONFIDENTIAL\n"); - fwrite($calfileh, "DTSTAMP:".dol_print_date($startdatef, "dayhourxcard", true)."\n"); + fwrite($calfileh, "DTSTAMP:".dol_print_date($startdatef, "dayhourxcard", 'gmt')."\n"); fwrite($calfileh, "END:VJOURNAL\n"); }