SlowSync/search issues with event pseudo exceptions

This commit is contained in:
Jörg Lehrke 2010-03-02 23:21:54 +00:00
parent 12ea8c4b1a
commit 31be31954e
4 changed files with 38 additions and 25 deletions

View File

@ -1205,8 +1205,12 @@ class calendar_boupdate extends calendar_bo
{
$recur_date = $event['start'];
}
$query[] = 'recur_type!='. MCAL_RECUR_NONE;
$query['cal_reference'] = 0;
}
if (!isset($event['reference'])) $event['reference'] = 0;
if ($event['id'])
{
if ($this->log)
@ -1240,12 +1244,6 @@ class calendar_boupdate extends calendar_bo
}
unset($event['id']);
if ($filter == 'master')
{
$query[] = 'recur_type!='. MCAL_RECUR_NONE;
$query['cal_reference'] = 0;
}
// only query calendars of users, we have READ-grants from
$users = array();
foreach(array_keys($this->grants) as $user)
@ -1346,10 +1344,6 @@ class calendar_boupdate extends calendar_bo
error_log(__FILE__.'['.__LINE__.'] '.__METHOD__.
'(' . $event['uid'] . ')[EventUID]');
}
if ($filter != 'master' && isset($event['reference']))
{
$query['cal_reference'] = $event['reference'];
}
}
if ($this->log)
@ -1381,8 +1375,29 @@ class calendar_boupdate extends calendar_bo
if (in_array($filter, array('exact', 'master')) && !empty($event['uid']))
{
$matchingEvents[] = $egwEvent['id']; // UID found
if ($filter = 'master') break;
// UID found
if ($egwEvent['reference'] == $event['reference'])
{
// We found the exact match
$matchingEvents[] = $egwEvent['id'];
break;
}
if (!$egwEvent['reference'])
{
// We found the master
if ($filter == 'master')
{
$matchingEvents[] = $egwEvent['id'];
break;
}
if (($egwEvent = $this->read($egwEvent['id'], $event['reference'], false, 'server'))
&& $egwEvent['reference'] == $event['reference'])
{
// We found a pseudo exception
$matchingEvents[] = $egwEvent['id'] . ':' . (int)$event['reference'];
break;
}
}
continue;
}

View File

@ -2710,9 +2710,14 @@ class calendar_ical extends calendar_boupdate
{
$filter = $relax ? 'relax' : 'check';
$event = array_shift($events);
$eventId = -1;
if ($this->isWholeDay($event, true)) $event['whole_day'] = true;
if ($contentID)
{
$parts = preg_split('/:/', $contentID);
$event['id'] = $eventId = $parts[0];
}
$event['category'] = $this->find_or_add_categories($event['category'], $eventId);
if ($contentID) $event['id'] = $contentID;
return $this->find_event($event, $filter);
}
if ($this->log)

View File

@ -546,13 +546,10 @@ class EGW_SyncML_State extends Horde_SyncML_State
'map_id' => $mapID,
'map_locuid' => $locid,
);
$data = array (
'map_expired' => true,
);
$GLOBALS['egw']->db->delete('egw_contentmap', $where,
__LINE__, __FILE__, 'syncml');
// delete all egw id's
// delete all EGw id's
$where = array(
'map_id' => $mapID,
'map_guid' => $guid,

View File

@ -86,7 +86,7 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
return $currentCmdID;
}
if ($locID = $state->getLocID($syncType, $guid)) {
if (($locID = $state->getLocID($syncType, $guid))) {
Horde::logMessage("SyncML: slowsync add to client: $guid ignored, already at client($locID)",
__FILE__, __LINE__, PEAR_LOG_DEBUG);
continue;
@ -266,7 +266,7 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
Horde::logMessage('SyncML: adding mapping for locuri:'
. $syncItem->getLocURI() . ' and guid:' . $guid,
__FILE__, __LINE__, PEAR_LOG_DEBUG);
$state->setUID($type, $syncItem->getLocURI(), $guid, mktime());
$state->setUID($type, $syncItem->getLocURI(), $guid);
$state->log("Client-Map");
continue;
}
@ -294,13 +294,9 @@ class Horde_SyncML_Sync_SlowSync extends Horde_SyncML_Sync_TwoWaySync {
$guid = $registry->call($hordeType . '/import',
array($state->convertClient2Server($syncItem->getContent(), $contentType), $contentType));
if (!is_a($guid, 'PEAR_Error') && $guid != false) {
$ts = $state->getSyncTSforAction($guid, 'modify');
if (!$ts) {
$ts = $state->getSyncTSforAction($guid, 'add');
}
$state->setUID($type, $syncItem->getLocURI(), $guid, $ts);
$state->setUID($type, $syncItem->getLocURI(), $guid);
$state->log("Client-AddReplace");
Horde::logMessage('SyncML: r/ added client entry as ' . $guid,
Horde::logMessage('SyncML: replaced/added client entry as ' . $guid,
__FILE__, __LINE__, PEAR_LOG_DEBUG);
} else {
Horde::logMessage('SyncML: Error in replacing/add client entry:' . $guid->message,