Limit the Timespan of Synchronisation

Got a problem with the Opacus SugarCRM Activities Sync? Please post it here
Post Reply
Martin
Posts: 14
Joined: Tue Jan 10, 2012 8:09 am

Limit the Timespan of Synchronisation

Post by Martin » Tue Feb 18, 2014 5:32 pm

Hi there,

we just installed SAS for a client.
He has a vanilla SugarCE 6.5.16.
SAS working ok so far.

But:
There are some users that have 100k+ activities in their history (Goldmine-import, data from way back since 1998)

Thunderbird Sync is breaking off here.

Is there a way to limit the time frame? Say "Sync everything since 01-01-2013" or something?

Thanks!
Last edited by Martin on Wed Feb 19, 2014 2:43 pm, edited 1 time in total.

Martin
Posts: 14
Joined: Tue Jan 10, 2012 8:09 am

Re: Limit the Timespan of Synchronisation

Post by Martin » Wed Feb 19, 2014 2:42 pm

So I went to:
OpacusDBhelper.php

and changed:

Code: Select all

       case "default":
                $query = "SELECT
                UNIX_TIMESTAMP(date_modified) AS datemodified,
                id,
                sugar_object_type,
                sugar_table_name
                FROM
                (
                 SELECT
                 date_modified,
                 id,
                 'Meeting' AS sugar_object_type,
                 'meetings' AS sugar_table_name
                 FROM
                 meetings
                 WHERE
                 assigned_user_id = ?
                 AND date_modified > ?
                UNION
                 SELECT
                 UNIX_TIMESTAMP(meetings.date_modified) AS datemodified,
                 meeting_id,
                 'Meeting' AS sugar_object_type,
                 'meetings' AS sugar_table_name
                 FROM
                 meetings
                 INNER JOIN
                 meetings_users
                 ON
                 meetings.id = meetings_users.meeting_id
                 WHERE
                 meetings_users.user_id = ?
                 AND meetings.deleted = 0
                 AND meetings_users.deleted = 0
                 AND (meetings.date_modified > ?
                 OR meetings_users.date_modified > ?)
                 
to

Code: Select all

switch ($calendarName) {
            case "default":
                $query = "SELECT
                UNIX_TIMESTAMP(date_modified) AS datemodified,
                id,
                sugar_object_type,
                sugar_table_name
                FROM
                (
                 SELECT
                 date_modified,
                 id,
                 'Meeting' AS sugar_object_type,
                 'meetings' AS sugar_table_name
                 FROM
                 meetings
                 WHERE
                 assigned_user_id = ?
                 AND date_modified > ?
                 AND meetings.date_start > '2014-01-01 00:00:00'
                 UNION
                 SELECT
                 UNIX_TIMESTAMP(meetings.date_modified) AS datemodified,
                 meeting_id,
                 'Meeting' AS sugar_object_type,
                 'meetings' AS sugar_table_name
                 FROM
                 meetings
                 INNER JOIN
                 meetings_users
                 ON
                 meetings.id = meetings_users.meeting_id
                 WHERE
                 meetings_users.user_id = ?
                 AND meetings.deleted = 0
                 AND meetings.date_start > '2014-01-01 00:00:00'    
                 AND meetings_users.deleted = 0
                 AND (meetings.date_modified > ?
                 OR meetings_users.date_modified > ?)
                 UNION
                 SELECT
                 UNIX_TIMESTAMP(date_modified) AS datemodified,
                 id,
                 'Task' AS sugar_object_type,
                 'tasks' AS sugar_table_name
                 FROM
                 tasks
                 WHERE
                 assigned_user_id = ?
                 AND date_modified > ?
                ) AS meetings_and_tasks
                GROUP BY id";
But this doesn't change the initial sync, it still grabs ALL the meetings that the user in Sugar has.

It does limit the Update though, meaning it's only updating events after the given date_start once they are in the Lightning Calendar.

Hmm.. any thoughts?
I can't find another routine getting meetings from Sugar.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest