Quantcast

[Vtigercrm-developers] Google Calendar Sync in vtiger 6.2

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Vtigercrm-developers] Google Calendar Sync in vtiger 6.2

Richard Hills - TechnologyWise
As some of you will be aware I have been experiencing issues with the google sync where entries are brought over from google with the wrong times.

I was now able to confirm this issue on a fresh installation of vtiger and would appreciate someone else verifying to ensure it is not an issue with our server.

Steps to verify:
  • Set up a google calendar and set the calendar timezone to "Auckland New Zealand GMT+12"
  • Install vtiger 6.2
    • Note, we use GMT+12 as our base time by setting, $default_timezone = 'Pacific/Auckland'; inside of config.inc.php
  • Enable the google calendar sync as outlined here: http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/8482
  • Adjust the file modules/Google/connectors/Oauth2.php on line 122 to remove the / after $site_URL.
  • Apply the change set here: http://trac.vtiger.com/cgi-bin/trac.cgi/changeset/14431
  • Create an entry starting at 09:00 and ending at 10:00 in google calendar
  • Synchronise with the CRM

If you get the same results as me you will find a new calendar event in the CRM scheduled from 20:00 to 21:00.

Sorry that this is not in trac yet, however as Uma confirmed that the vtiger team will look at this I thought maybe I would be duplicating something. Uma did you ever get any results from that investigation?

Thank you



-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061

_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Google Calendar Sync in vtiger 6.2

Uma S
Hi Richard,

We had tested this case against two different time-zones in latest vtiger 6.2 source, where we are unable to reproduce the issue. Where mapping of calendar event wen in accordance with crm timezone settings.

Will check the above case defined by you again and let you know the results and analysis. As the team member handling google sync is away for two days, will get back to you by monday.

Thank! for your patience.

On Fri, Feb 27, 2015 at 2:35 AM, Richard Hills - Technologywise <[hidden email]> wrote:
As some of you will be aware I have been experiencing issues with the google sync where entries are brought over from google with the wrong times.

I was now able to confirm this issue on a fresh installation of vtiger and would appreciate someone else verifying to ensure it is not an issue with our server.

Steps to verify:
  • Set up a google calendar and set the calendar timezone to "Auckland New Zealand GMT+12"
  • Install vtiger 6.2
    • Note, we use GMT+12 as our base time by setting, $default_timezone = 'Pacific/Auckland'; inside of config.inc.php
  • Enable the google calendar sync as outlined here: http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/8482
  • Adjust the file modules/Google/connectors/Oauth2.php on line 122 to remove the / after $site_URL.
  • Apply the change set here: http://trac.vtiger.com/cgi-bin/trac.cgi/changeset/14431
  • Create an entry starting at 09:00 and ending at 10:00 in google calendar
  • Synchronise with the CRM

If you get the same results as me you will find a new calendar event in the CRM scheduled from 20:00 to 21:00.

Sorry that this is not in trac yet, however as Uma confirmed that the vtiger team will look at this I thought maybe I would be duplicating something. Uma did you ever get any results from that investigation?

Thank you



-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061

_______________________________________________
http://www.vtiger.com/



--
With
Best Regards
Uma.S
Vtiger Team

_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Google Calendar Sync in vtiger 6.2

Richard Hills - TechnologyWise
In reply to this post by Richard Hills - TechnologyWise
Just confirming this is actually working on a different server for me. I believe this is an issue with timezone support on our server. Will let you all know if I can actually find something to pin the blame on.

On 27/02/15 10:05, Richard Hills - Technologywise wrote:
As some of you will be aware I have been experiencing issues with the google sync where entries are brought over from google with the wrong times.

I was now able to confirm this issue on a fresh installation of vtiger and would appreciate someone else verifying to ensure it is not an issue with our server.

Steps to verify:
  • Set up a google calendar and set the calendar timezone to "Auckland New Zealand GMT+12"
  • Install vtiger 6.2
    • Note, we use GMT+12 as our base time by setting, $default_timezone = 'Pacific/Auckland'; inside of config.inc.php
  • Enable the google calendar sync as outlined here: http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/8482
  • Adjust the file modules/Google/connectors/Oauth2.php on line 122 to remove the / after $site_URL.
  • Apply the change set here: http://trac.vtiger.com/cgi-bin/trac.cgi/changeset/14431
  • Create an entry starting at 09:00 and ending at 10:00 in google calendar
  • Synchronise with the CRM

If you get the same results as me you will find a new calendar event in the CRM scheduled from 20:00 to 21:00.

Sorry that this is not in trac yet, however as Uma confirmed that the vtiger team will look at this I thought maybe I would be duplicating something. Uma did you ever get any results from that investigation?

Thank you



-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061


_______________________________________________
http://www.vtiger.com/

-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061

_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Google Calendar Sync in vtiger 6.2

Richard Hills - TechnologyWise
Just another question should anyone know.

Inside ./modules/Google/connectors/Calendar.php function transformToSourceRecord

time_start/time_end are set up (as utc), but where is the step where this is meant to be converted to the server timezone? I could not find this and it is clearly what is failing for us (as all our imported records are ignoring timezone setting and being pushed into the database as UTC).

Thanks



On 02/03/15 11:09, Richard Hills - Technologywise wrote:
Just confirming this is actually working on a different server for me. I believe this is an issue with timezone support on our server. Will let you all know if I can actually find something to pin the blame on.

On 27/02/15 10:05, Richard Hills - Technologywise wrote:
As some of you will be aware I have been experiencing issues with the google sync where entries are brought over from google with the wrong times.

I was now able to confirm this issue on a fresh installation of vtiger and would appreciate someone else verifying to ensure it is not an issue with our server.

Steps to verify:
  • Set up a google calendar and set the calendar timezone to "Auckland New Zealand GMT+12"
  • Install vtiger 6.2
    • Note, we use GMT+12 as our base time by setting, $default_timezone = 'Pacific/Auckland'; inside of config.inc.php
  • Enable the google calendar sync as outlined here: http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/8482
  • Adjust the file modules/Google/connectors/Oauth2.php on line 122 to remove the / after $site_URL.
  • Apply the change set here: http://trac.vtiger.com/cgi-bin/trac.cgi/changeset/14431
  • Create an entry starting at 09:00 and ending at 10:00 in google calendar
  • Synchronise with the CRM

If you get the same results as me you will find a new calendar event in the CRM scheduled from 20:00 to 21:00.

Sorry that this is not in trac yet, however as Uma confirmed that the vtiger team will look at this I thought maybe I would be duplicating something. Uma did you ever get any results from that investigation?

Thank you



-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061


_______________________________________________
http://www.vtiger.com/

-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061


_______________________________________________
http://www.vtiger.com/

-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061

_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Google Calendar Sync in vtiger 6.2

Richard Hills - TechnologyWise
Another bit of the puzzle.

When I change modules/Google/models/Calendar.php functions getEndTimeUTC and getStartTimeUTC to use the default_timezone set in config.inc.php I am able to import from google without the dates being imported incorrectly as UTC.

The name of this function makes me believe that this is still not a solution but rather an incorrect workaround, really keen to hear where the translation from UTC to default timezone is meant to be done so that I can debug that.

On 02/03/15 14:49, Richard Hills - Technologywise wrote:
Just another question should anyone know.

Inside ./modules/Google/connectors/Calendar.php function transformToSourceRecord

time_start/time_end are set up (as utc), but where is the step where this is meant to be converted to the server timezone? I could not find this and it is clearly what is failing for us (as all our imported records are ignoring timezone setting and being pushed into the database as UTC).

Thanks



On 02/03/15 11:09, Richard Hills - Technologywise wrote:
Just confirming this is actually working on a different server for me. I believe this is an issue with timezone support on our server. Will let you all know if I can actually find something to pin the blame on.

On 27/02/15 10:05, Richard Hills - Technologywise wrote:
As some of you will be aware I have been experiencing issues with the google sync where entries are brought over from google with the wrong times.

I was now able to confirm this issue on a fresh installation of vtiger and would appreciate someone else verifying to ensure it is not an issue with our server.

Steps to verify:
  • Set up a google calendar and set the calendar timezone to "Auckland New Zealand GMT+12"
  • Install vtiger 6.2
    • Note, we use GMT+12 as our base time by setting, $default_timezone = 'Pacific/Auckland'; inside of config.inc.php
  • Enable the google calendar sync as outlined here: http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/8482
  • Adjust the file modules/Google/connectors/Oauth2.php on line 122 to remove the / after $site_URL.
  • Apply the change set here: http://trac.vtiger.com/cgi-bin/trac.cgi/changeset/14431
  • Create an entry starting at 09:00 and ending at 10:00 in google calendar
  • Synchronise with the CRM

If you get the same results as me you will find a new calendar event in the CRM scheduled from 20:00 to 21:00.

Sorry that this is not in trac yet, however as Uma confirmed that the vtiger team will look at this I thought maybe I would be duplicating something. Uma did you ever get any results from that investigation?

Thank you



-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061


_______________________________________________
http://www.vtiger.com/

-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061


_______________________________________________
http://www.vtiger.com/

-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061


_______________________________________________
http://www.vtiger.com/

-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061

_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Google Calendar Sync in vtiger 6.2

Richard Hills - TechnologyWise
After further testing I confirmed this bug on multiple servers.

This now works for us after the following changes, please note that line numbers may be slightly off due to editing the files:

modules/Google/connectors/Calendar.php line 143:
was            $maxModifiedTime = date('Y-m-d H:i:s', strtotime(Google_Contacts_Model::vtigerFormat(end($calendarRecords)->getUpdated())) + 1);
now            $maxModifiedTime = date('Y-m-d H:i:s', strtotime(Google_Calendar_Model::vtigerFormat(end($calendarRecords)->getUpdated())) + 1);

./modules/Google/models/Calendar.php
    public function vtigerFormat($date) {
        // EDIT
        $origDate = $date;
        // END EDIT
        list($date, $timestring) = explode('T', $date);
        list($time, $tz) = explode('.', $timestring);
        // EDIT - if this is UTC lets change it to correct system time
        if(substr($tz,-1) == 'Z') {
                $date = new DateTime($origDate);
                $timeZone = new DateTimeZone(date_default_timezone_get());
                $date->setTimezone($timeZone);
                $date = $date->format('Y-m-d H:i:s');
                return $date;
        }
        // END EDIT
        return $date . " " . $time;
    }

    function getStartTimeUTC($user = false) {     AND     function getEndTimeUTC($user = false) {
was     $timeZone = new DateTimeZone('UTC');
now     $timeZone = new DateTimeZone(date_default_timezone_get());


Would love to get some feedback from the vtiger team.



On 03/03/15 11:54, Richard Hills - Technologywise wrote:
Another bit of the puzzle.

When I change modules/Google/models/Calendar.php functions getEndTimeUTC and getStartTimeUTC to use the default_timezone set in config.inc.php I am able to import from google without the dates being imported incorrectly as UTC.

The name of this function makes me believe that this is still not a solution but rather an incorrect workaround, really keen to hear where the translation from UTC to default timezone is meant to be done so that I can debug that.

On 02/03/15 14:49, Richard Hills - Technologywise wrote:
Just another question should anyone know.

Inside ./modules/Google/connectors/Calendar.php function transformToSourceRecord

time_start/time_end are set up (as utc), but where is the step where this is meant to be converted to the server timezone? I could not find this and it is clearly what is failing for us (as all our imported records are ignoring timezone setting and being pushed into the database as UTC).

Thanks



On 02/03/15 11:09, Richard Hills - Technologywise wrote:
Just confirming this is actually working on a different server for me. I believe this is an issue with timezone support on our server. Will let you all know if I can actually find something to pin the blame on.

On 27/02/15 10:05, Richard Hills - Technologywise wrote:
As some of you will be aware I have been experiencing issues with the google sync where entries are brought over from google with the wrong times.

I was now able to confirm this issue on a fresh installation of vtiger and would appreciate someone else verifying to ensure it is not an issue with our server.

Steps to verify:
  • Set up a google calendar and set the calendar timezone to "Auckland New Zealand GMT+12"
  • Install vtiger 6.2
    • Note, we use GMT+12 as our base time by setting, $default_timezone = 'Pacific/Auckland'; inside of config.inc.php
  • Enable the google calendar sync as outlined here: http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/8482
  • Adjust the file modules/Google/connectors/Oauth2.php on line 122 to remove the / after $site_URL.
  • Apply the change set here: http://trac.vtiger.com/cgi-bin/trac.cgi/changeset/14431
  • Create an entry starting at 09:00 and ending at 10:00 in google calendar
  • Synchronise with the CRM

If you get the same results as me you will find a new calendar event in the CRM scheduled from 20:00 to 21:00.

Sorry that this is not in trac yet, however as Uma confirmed that the vtiger team will look at this I thought maybe I would be duplicating something. Uma did you ever get any results from that investigation?

Thank you



-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061


_______________________________________________
http://www.vtiger.com/

-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061


_______________________________________________
http://www.vtiger.com/

-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061


_______________________________________________
http://www.vtiger.com/

-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061


_______________________________________________
http://www.vtiger.com/

-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061

_______________________________________________
http://www.vtiger.com/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Google Calendar Sync in vtiger 6.2

Uma S
Hi,

The above shared code by you, has been verified by our end. Will be picking up these changes through this trac. Please do update your further updates in this trac.

On Wed, Mar 4, 2015 at 3:45 AM, Richard Hills - Technologywise <[hidden email]> wrote:
After further testing I confirmed this bug on multiple servers.

This now works for us after the following changes, please note that line numbers may be slightly off due to editing the files:

modules/Google/connectors/Calendar.php line 143:
was            $maxModifiedTime = date('Y-m-d H:i:s', strtotime(Google_Contacts_Model::vtigerFormat(end($calendarRecords)->getUpdated())) + 1);
now            $maxModifiedTime = date('Y-m-d H:i:s', strtotime(Google_Calendar_Model::vtigerFormat(end($calendarRecords)->getUpdated())) + 1);

./modules/Google/models/Calendar.php
    public function vtigerFormat($date) {
        // EDIT
        $origDate = $date;
        // END EDIT
        list($date, $timestring) = explode('T', $date);
        list($time, $tz) = explode('.', $timestring);
        // EDIT - if this is UTC lets change it to correct system time
        if(substr($tz,-1) == 'Z') {
                $date = new DateTime($origDate);
                $timeZone = new DateTimeZone(date_default_timezone_get());
                $date->setTimezone($timeZone);
                $date = $date->format('Y-m-d H:i:s');
                return $date;
        }
        // END EDIT
        return $date . " " . $time;
    }

    function getStartTimeUTC($user = false) {     AND     function getEndTimeUTC($user = false) {
was     $timeZone = new DateTimeZone('UTC');
now     $timeZone = new DateTimeZone(date_default_timezone_get());


Would love to get some feedback from the vtiger team.




On 03/03/15 11:54, Richard Hills - Technologywise wrote:
Another bit of the puzzle.

When I change modules/Google/models/Calendar.php functions getEndTimeUTC and getStartTimeUTC to use the default_timezone set in config.inc.php I am able to import from google without the dates being imported incorrectly as UTC.

The name of this function makes me believe that this is still not a solution but rather an incorrect workaround, really keen to hear where the translation from UTC to default timezone is meant to be done so that I can debug that.

On 02/03/15 14:49, Richard Hills - Technologywise wrote:
Just another question should anyone know.

Inside ./modules/Google/connectors/Calendar.php function transformToSourceRecord

time_start/time_end are set up (as utc), but where is the step where this is meant to be converted to the server timezone? I could not find this and it is clearly what is failing for us (as all our imported records are ignoring timezone setting and being pushed into the database as UTC).

Thanks



On 02/03/15 11:09, Richard Hills - Technologywise wrote:
Just confirming this is actually working on a different server for me. I believe this is an issue with timezone support on our server. Will let you all know if I can actually find something to pin the blame on.

On 27/02/15 10:05, Richard Hills - Technologywise wrote:
As some of you will be aware I have been experiencing issues with the google sync where entries are brought over from google with the wrong times.

I was now able to confirm this issue on a fresh installation of vtiger and would appreciate someone else verifying to ensure it is not an issue with our server.

Steps to verify:
  • Set up a google calendar and set the calendar timezone to "Auckland New Zealand GMT+12"
  • Install vtiger 6.2
    • Note, we use GMT+12 as our base time by setting, $default_timezone = 'Pacific/Auckland'; inside of config.inc.php
  • Enable the google calendar sync as outlined here: http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/8482
  • Adjust the file modules/Google/connectors/Oauth2.php on line 122 to remove the / after $site_URL.
  • Apply the change set here: http://trac.vtiger.com/cgi-bin/trac.cgi/changeset/14431
  • Create an entry starting at 09:00 and ending at 10:00 in google calendar
  • Synchronise with the CRM

If you get the same results as me you will find a new calendar event in the CRM scheduled from 20:00 to 21:00.

Sorry that this is not in trac yet, however as Uma confirmed that the vtiger team will look at this I thought maybe I would be duplicating something. Uma did you ever get any results from that investigation?

Thank you



-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061


_______________________________________________
http://www.vtiger.com/

-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061


_______________________________________________
http://www.vtiger.com/

-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061


_______________________________________________
http://www.vtiger.com/

-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061


_______________________________________________
http://www.vtiger.com/

-- 
Richard Hills
TechnologyWise Ltd, Tauranga, NZ
[hidden email]
www.technologywise.co.nz
ph: +64 (0)7 571 1060
fax: +64 (0)7 571 1061

_______________________________________________
http://www.vtiger.com/



--
With
Best Regards
Uma.S
Vtiger Team

_______________________________________________
http://www.vtiger.com/
Loading...