salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.41k stars 2.06k forks source link

iCal sync problems at timezones without summer time #2726

Open fuguet opened 7 years ago

fuguet commented 7 years ago

I detect a bug with some specific timezones that dont have summer/winter time (all the year is the same time like Argentina).

That situation cause that when you are using this kind of timezones, the script skips the generation of the groups DAYLIGHT and STANDAR at the ICS and this cause some incompatibilities problem with calendars like Android (it syncs but ignoring the correct timezone and converting all the dates to UTC) and Office 365 (dont sync at all, only keep the calendar empty).

Expected Behavior

Syncs the calendar with every platform and application without date and time errors

Actual Behavior

Only some specific applications and platforms can sync correctly. Android and Office365 not working correctly. Dekstop Outlook, Gmail, Yahoo working correctly (cant test another platforms).

Possible Fix

I´m not an expert at php but a temporal fix that works for me was to manually generate the groups DAYLIGHT and STANDAR with a fake summe time at the function getTimeZoneString(); at /modules/iCals/iCals.php and comment the conditions that are making the bug:

$ical_array[]` = array("BEGIN", "DAYLIGHT"); $ical_array[] = array("TZOFFSETFROM", "-0300"); $ical_array[] = array("TZOFFSETTO", "-0300"); $ical_array[] = array("TZNAME", "PDT"); $ical_array[] = array("DTSTART", "19700101T020000"); $ical_array[] = array("END", "DAYLIGHT"); $ical_array[] = array("BEGIN", "STANDARD"); $ical_array[] = array("TZOFFSETFROM", "-0300"); $ical_array[] = array("TZOFFSETTO", "-0300"); $ical_array[] = array("TZNAME", "PST"); $ical_array[] = array("DTSTART", "19701101T020000"); $ical_array[] = array("END", "STANDARD");

An comment the following conditions:

    if (array_key_exists('start', $dstRange))
   {
        ...
    }

    if (array_key_exists('end', $dstRange))
    {
        ...
    }

I think someone can find a better solution

Steps to Reproduce

If you want to reproduce only have to test how the ICS is generated with this two timezones:

Also a great validator to test the ICS generated: http://severinghaus.org/projects/icv/

Your Environment

shogunpol commented 7 years ago

@fuguet , are you talk about server time zone, or system (SuiteCRM) time zone?

fuguet commented 7 years ago

@shogunpol sorry for missing this detail, I´m talking about the SuiteCRM time zone.

The server time zone where I do the tests is also America/Argentina/Buenos_Aires (GMT-3)

cperrot commented 5 years ago

I am having similar problems when integrating the ical interface into Outlook 2016 with Australia/Brisbane timezone both server and SuiteCRM in the same timezone. However the Outlook client is in Timezone Switzerland/Zurich

untitled

cperrot commented 5 years ago

I have fixed the code in order to import something into Outlook 2016

in modules/iCals/iCal.php I have added following code at line 508 in the function getTimezoneString()

if (!array_key_exists('end', $dstRange) && !array_key_exists('start', $dstRange)){
    $timezone = new DateTimeZone($timezoneName);
    $offset   = $timezone->getOffset(new DateTime) / 60;
        $ical_array[] = array("BEGIN", "STANDARD");
        $ical_array[] = array("TZOFFSETFROM", $this->convertMinsToHoursAndMins($offset));
        $ical_array[] = array("TZOFFSETTO", $this->convertMinsToHoursAndMins($offset));
        $ical_array[] = array("END", "STANDARD");
   }

This generates a compliant iCal stream based on https://icalendar.org/validator.html Hope that helps