Skip to content
Snippets Groups Projects
Commit 48b16520 authored by Uma's avatar Uma
Browse files

Merge branch 'google_cal_sync_minimum_date2' into '7.4.0'

Google cal sync minimum date2

fix for #1614 for syncing calendar with start date -1 month

See merge request !825
parents f990962c 1c7bf2c9
No related branches found
No related tags found
No related merge requests found
No preview for this file type
...@@ -142,17 +142,18 @@ Class Google_Calendar_Connector extends WSAPP_TargetConnector { ...@@ -142,17 +142,18 @@ Class Google_Calendar_Connector extends WSAPP_TargetConnector {
$this->client->setAccessToken($this->apiConnection->getAccessToken()); $this->client->setAccessToken($this->apiConnection->getAccessToken());
$this->service = new Google_Service_Calendar($this->client); $this->service = new Google_Service_Calendar($this->client);
} }
$query = array(
'maxResults' => $this->maxResults,
'orderBy' => 'updated',
'singleEvents' => true,
);
if (Google_Utils_Helper::getSyncTime('Calendar', $user)) { if (Google_Utils_Helper::getSyncTime('Calendar', $user)) {
$query['updatedMin'] = $this->googleFormat(Google_Utils_Helper::getSyncTime('Calendar', $user)); $query['updatedMin'] = $this->googleFormat(Google_Utils_Helper::getSyncTime('Calendar', $user));
//shows deleted by default //shows deleted by default
} }
$query['updatedMin'] = date('Y-m-d\TH:i:s\Z', strtotime("-7 days"));
$query['orderBy'] = 'startTime';
$query['timeMin'] = date('c',strtotime("-30 days"));
$query['showDeleted'] = false;
$calendarId = Google_Utils_Helper::getSelectedCalendarForUser($user); $calendarId = Google_Utils_Helper::getSelectedCalendarForUser($user);
if(!isset($this->calendars)) { if(!isset($this->calendars)) {
$this->calendars = $this->pullCalendars(true); $this->calendars = $this->pullCalendars(true);
......
...@@ -643,6 +643,13 @@ Class Google_Contacts_Connector extends WSAPP_TargetConnector { ...@@ -643,6 +643,13 @@ Class Google_Contacts_Connector extends WSAPP_TargetConnector {
$payLoad = html_entity_decode($atom->asXML(), ENT_QUOTES, $default_charset); $payLoad = html_entity_decode($atom->asXML(), ENT_QUOTES, $default_charset);
$response = $this->sendBatchRequest($payLoad); $response = $this->sendBatchRequest($payLoad);
$main1 = new SimpleXMLElement($payLoad);
$main1->entry->addAttribute('gd:etag', '*');
$payLoad = $main1->asXML();
if($response) { if($response) {
$responseXml = simplexml_load_string($response); $responseXml = simplexml_load_string($response);
$responseXml->registerXPathNamespace('gd', $this->NS['gd']); $responseXml->registerXPathNamespace('gd', $this->NS['gd']);
...@@ -711,6 +718,12 @@ Class Google_Contacts_Connector extends WSAPP_TargetConnector { ...@@ -711,6 +718,12 @@ Class Google_Contacts_Connector extends WSAPP_TargetConnector {
} }
} }
$payLoad = html_entity_decode($atom->asXML(), ENT_QUOTES, $default_charset); $payLoad = html_entity_decode($atom->asXML(), ENT_QUOTES, $default_charset);
$main1 = new SimpleXMLElement($payLoad);
$main1->entry->addAttribute('gd:etag', '*');
$payLoad = $main1->asXML();
$response = $this->sendBatchRequest($payLoad); $response = $this->sendBatchRequest($payLoad);
$responseXml = simplexml_load_string($response); $responseXml = simplexml_load_string($response);
if($responseXml) { if($responseXml) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment