|
@@ -179,12 +179,13 @@ if (empty($conf->global->AGENDA_DISABLE_EXT))
|
|
|
$i++;
|
|
|
$source='AGENDA_EXT_SRC'.$i;
|
|
|
$name='AGENDA_EXT_NAME'.$i;
|
|
|
+ $offsettz='AGENDA_EXT_OFFSETTZ'.$i;
|
|
|
$color='AGENDA_EXT_COLOR'.$i;
|
|
|
$buggedfile='AGENDA_EXT_BUGGEDFILE'.$i;
|
|
|
if (! empty($conf->global->$source) && ! empty($conf->global->$name))
|
|
|
{
|
|
|
// Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
|
|
|
- $listofextcals[]=array('src'=>$conf->global->$source,'name'=>$conf->global->$name,'color'=>$conf->global->$color,'buggedfile'=>(isset($conf->global->buggedfile)?$conf->global->buggedfile:0));
|
|
|
+ $listofextcals[]=array('src'=>$conf->global->$source,'name'=>$conf->global->$name,'offsettz'=>$conf->global->$offsettz,'color'=>$conf->global->$color,'buggedfile'=>(isset($conf->global->buggedfile)?$conf->global->buggedfile:0));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -197,13 +198,14 @@ if (empty($user->conf->AGENDA_DISABLE_EXT))
|
|
|
$i++;
|
|
|
$source='AGENDA_EXT_SRC_'.$user->id.'_'.$i;
|
|
|
$name='AGENDA_EXT_NAME_'.$user->id.'_'.$i;
|
|
|
+ $offsettz='AGENDA_EXT_OFFSETTZ_'.$user->id.'_'.$i;
|
|
|
$color='AGENDA_EXT_COLOR_'.$user->id.'_'.$i;
|
|
|
$enabled='AGENDA_EXT_ENABLED_'.$user->id.'_'.$i;
|
|
|
$buggedfile='AGENDA_EXT_BUGGEDFILE_'.$user->id.'_'.$i;
|
|
|
if (! empty($user->conf->$source) && ! empty($user->conf->$name))
|
|
|
{
|
|
|
// Note: $conf->global->buggedfile can be empty or 'uselocalandtznodaylight' or 'uselocalandtzdaylight'
|
|
|
- $listofextcals[]=array('src'=>$user->conf->$source,'name'=>$user->conf->$name,'color'=>$user->conf->$color,'buggedfile'=>(isset($user->conf->buggedfile)?$user->conf->buggedfile:0));
|
|
|
+ $listofextcals[]=array('src'=>$user->conf->$source,'name'=>$user->conf->$name,'offsettz'=>$user->conf->$offsettz,'color'=>$user->conf->$color,'buggedfile'=>(isset($user->conf->buggedfile)?$user->conf->buggedfile:0));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -507,8 +509,12 @@ if ($resql)
|
|
|
// Create a new object action
|
|
|
$event=new ActionComm($db);
|
|
|
$event->id=$obj->id;
|
|
|
- $event->datep=$db->jdate($obj->datep); // datep and datef are GMT date
|
|
|
+
|
|
|
+ $event->datep=$db->jdate($obj->datep); // datep and datef are GMT date. Example: 1970-01-01 01:00:00, jdate will return 0 if TZ of PHP server is Europe/Berlin
|
|
|
$event->datef=$db->jdate($obj->datep2);
|
|
|
+ //var_dump($obj->datep);
|
|
|
+ //var_dump($event->datep);
|
|
|
+
|
|
|
$event->type_code=$obj->type_code;
|
|
|
$event->type_label=$obj->type_label;
|
|
|
$event->libelle=$obj->label;
|
|
@@ -664,6 +670,7 @@ if (count($listofextcals))
|
|
|
{
|
|
|
$url=$extcal['src']; // Example: https://www.google.com/calendar/ical/eldy10%40gmail.com/private-cde92aa7d7e0ef6110010a821a2aaeb/basic.ics
|
|
|
$namecal = $extcal['name'];
|
|
|
+ $offsettz = $extcal['offsettz'];
|
|
|
$colorcal = $extcal['color'];
|
|
|
$buggedfile = $extcal['buggedfile'];
|
|
|
//print "url=".$url." namecal=".$namecal." colorcal=".$colorcal." buggedfile=".$buggedfile;
|
|
@@ -805,12 +812,22 @@ if (count($listofextcals))
|
|
|
{
|
|
|
$datestart=$icalevent['DTSTART'];
|
|
|
$dateend=$icalevent['DTEND'];
|
|
|
+
|
|
|
+ $datestart+=+($offsettz * 3600);
|
|
|
+ $dateend+=+($offsettz * 3600);
|
|
|
+
|
|
|
$addevent=true;
|
|
|
+ //var_dump($offsettz);
|
|
|
+ //var_dump(dol_print_date($datestart, 'dayhour', 'gmt'));
|
|
|
}
|
|
|
elseif (isset($icalevent['DTSTART']['unixtime'])) // File contains a local timezone + a TZ (for example when using bluemind)
|
|
|
{
|
|
|
$datestart=$icalevent['DTSTART']['unixtime'];
|
|
|
$dateend=$icalevent['DTEND']['unixtime'];
|
|
|
+
|
|
|
+ $datestart+=+($offsettz * 3600);
|
|
|
+ $dateend+=+($offsettz * 3600);
|
|
|
+
|
|
|
// $buggedfile is set to uselocalandtznodaylight if conf->global->AGENDA_EXT_BUGGEDFILEx = 'uselocalandtznodaylight'
|
|
|
if ($buggedfile === 'uselocalandtznodaylight') // unixtime is a local date that does not take daylight into account, TZID is +1 for example for 'Europe/Paris' in summer instead of 2
|
|
|
{
|
|
@@ -1308,7 +1325,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|
|
// Hour start
|
|
|
if ($tmpyearstart == $annee && $tmpmonthstart == $mois && $tmpdaystart == $jour)
|
|
|
{
|
|
|
- $daterange.=dol_print_date($event->date_start_in_calendar,'%H:%M');
|
|
|
+ $daterange.=dol_print_date($event->date_start_in_calendar,'%H:%M'); // Il faudrait utiliser ici tzuser, mais si on ne peut pas car qd on rentre un date dans fiche action, en input la conversion local->gmt se base sur le TZ server et non user
|
|
|
if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar)
|
|
|
{
|
|
|
if ($tmpyearstart == $tmpyearend && $tmpmonthstart == $tmpmonthend && $tmpdaystart == $tmpdayend)
|
|
@@ -1328,7 +1345,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
|
|
if ($event->date_end_in_calendar && $event->date_start_in_calendar != $event->date_end_in_calendar)
|
|
|
{
|
|
|
if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour)
|
|
|
- $daterange.=dol_print_date($event->date_end_in_calendar,'%H:%M');
|
|
|
+ $daterange.=dol_print_date($event->date_end_in_calendar,'%H:%M'); // Il faudrait utiliser ici tzuser, mais si on ne peut pas car qd on rentre un date dans fiche action, en input la conversion local->gmt se base sur le TZ server et non user
|
|
|
}
|
|
|
//print $daterange;
|
|
|
if ($event->type_code != 'ICALEVENT')
|