'dtstart' => '2011-04-21 10:00:00',
'dtend' => '2011-04-21 12:00:00',
'originator_tz' => 'Europe/Berlin',
- 'rrule' => 'FREQ=DAILY;INTERVAL=1;UNTIL=2011-04-27 21:59:59',
+ 'rrule' => 'FREQ=DAILY;INTERVAL=1;UNTIL=2011-04-28 21:59:59',
'container_id' => $this->_getTestCalendar()->getId()
));
$recurSet->summary = 'Limo bei Schweinske';
$recurSet[5]->dtstart->addHour(2);
$recurSet[5]->dtend->addHour(2);
+
+ $recurSet[6]->dtstart->subDay(6);
+ $recurSet[6]->dtend->subDay(6);
$this->_controller->createRecurException($recurSet[1], TRUE); // (23) delete instance
$updatedBaseEvent = $this->_controller->getRecurBaseEvent($recurSet[5]);
$recurSet[5]->last_modified_time = $updatedBaseEvent->last_modified_time;
$this->_controller->createRecurException($recurSet[5], FALSE); // (27) move instance
+
+ $updatedBaseEvent = $this->_controller->getRecurBaseEvent($recurSet[6]);
+ $recurSet[6]->last_modified_time = $updatedBaseEvent->last_modified_time;
+ $this->_controller->createRecurException($recurSet[6], FALSE); // (28) move instance to 22
// now test update allfollowing
$recurSet[3]->summary = 'Spezi bei Schwinske';
$updatedBaseEvent = $this->_controller->getRecurBaseEvent($recurSet[3]);
$recurSet[3]->last_modified_time = $updatedBaseEvent->last_modified_time;
- $newBaseEvent = $this->_controller->createRecurException($recurSet[3], FALSE, TRUE);
+ $newBaseEvent = $this->_controller->createRecurException($recurSet[3], FALSE, TRUE); // split at 25
$events = $this->_controller->search(new Calendar_Model_EventFilter(array(
array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_getTestCalendar()->getId()),
))));
Calendar_Model_Rrule::mergeRecurrenceSet($events, $from, $until);
- $this->assertEquals(6, count($events), 'there should be exactly 6 events');
+ $this->assertEquals(7, count($events), 'there should be exactly 6 events');
$oldSeries = $events->filter('uid', $persistentEvent->uid);
$newSeries = $events->filter('uid', $newBaseEvent->uid);
$this->assertEquals(3, count($oldSeries), 'there should be exactly 3 events with old uid');
- $this->assertEquals(3, count($newSeries), 'there should be exactly 3 events with new uid');
+ $this->assertEquals(4, count($newSeries), 'there should be exactly 3 events with new uid');
$this->assertEquals(1, count($oldSeries->filter('recurid', "/^$/", TRUE)), 'there should be exactly one old base event');
$this->assertEquals(1, count($newSeries->filter('recurid', "/^$/", TRUE)), 'there should be exactly one new base event');
$this->assertEquals(1, count($oldSeries->filter('recurid', "/^.+/", TRUE)->filter('rrule', '/^$/', TRUE)), 'there should be exactly one old persitent event exception');
- $this->assertEquals(1, count($newSeries->filter('recurid', "/^.+/", TRUE)->filter('rrule', '/^$/', TRUE)), 'there should be exactly one new persitent event exception');
+ $this->assertEquals(2, count($newSeries->filter('recurid', "/^.+/", TRUE)->filter('rrule', '/^$/', TRUE)), 'there should be exactly one new persitent event exception');
$this->assertEquals(1, count($oldSeries->filter('id', "/^fake.*/", TRUE)), 'there should be exactly one old fake event');
$this->assertEquals(1, count($newSeries->filter('id', "/^fake.*/", TRUE)), 'there should be exactly one new fake event'); //26 (reset)
$this->assertFalse(!!array_diff($newBaseEvent->exdate, array(
new Tinebase_DateTime('2011-04-27 14:00:00'),
+ new Tinebase_DateTime('2011-04-28 14:00:00'),
)), 'exdate of new series');
$this->assertFalse(!!array_diff($oldSeries->dtstart, array(
new Tinebase_DateTime('2011-04-22 10:00:00'),
new Tinebase_DateTime('2011-04-24 10:00:00'),
)), 'dtstart of old series');
-
+
$this->assertFalse(!!array_diff($newSeries->dtstart, array(
new Tinebase_DateTime('2011-04-25 14:00:00'),
new Tinebase_DateTime('2011-04-26 14:00:00'),
new Tinebase_DateTime('2011-04-27 12:00:00'),
+ new Tinebase_DateTime('2011-04-22 10:00:00'),
)), 'dtstart of new series');
}
// assert attendee are preserved
$updatedEvent = Calendar_Controller_MSEventFacade::getInstance()->get($serverId);
- $this->assertNotEmpty($updatedEvent->attendee, 'attendee must be preserved during update');
+ $this->assertNotEmpty($updatedEvent, 'attendee must be preserved during update');
}
/**
*
* for iOS devices we need to suppress attendee during sync for non default folder (see foldertype in foldersync)
* iOS can only have one default folder
- *
- * NOTE: our implementation in not correct at the moment as we only append attendee if the event is in the default folder.
- * correct implementation would be to append attendee when default folder is synced
*/
public function testUpdateEntriesIPhoneNonDefaultFolder()
{
$this->assertEquals($syncrotonEventtoUpdate->exceptions[0]->startTime->toString(), $updatedSyncrotonEvent->exceptions[0]->startTime->toString());
// assert attendee are preserved
- $updatedEvent = Calendar_Controller_MSEventFacade::getInstance()->get($serverId);
- $this->assertNotEmpty($updatedEvent->attendee, 'attendee must be preserved during update');
+ $this->assertNotEmpty($updatedSyncrotonEvent->attendees, 'attendee must be preserved during update');
}
}
/**
* reset sync for user
*
- * @param string $username
+ * @param mixed $user
* @param array $classesToReset
* @return boolean
*/
- public function resetSyncForUser($username, $classesToReset)
+ public function resetSyncForUser($user, $classesToReset)
{
+
+ if (! $user instanceof Tinebase_Model_User) {
+ try {
+ $user = Tinebase_User::getInstance()->getFullUserById($user);
+ } catch (Tinebase_Exception_NotFound $tenf) {
+ $user = Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountLoginName', $user);
+ }
+ }
+
if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__
- . ' Resetting sync for user ' . $username . ' collections: ' . print_r($classesToReset, true));
-
- $user = Tinebase_User::getInstance()->getUserByPropertyFromSqlBackend('accountLoginName', $username);
-
+ . ' Resetting sync for user ' . $user->accountDisplayName . ' collections: ' . print_r($classesToReset, true));
+
self::initSyncrotonRegistry();
- $devices = $this->_getDevicesForUser($user);
+ $devices = $this->_getDevicesForUser($user->getId());
foreach ($devices as $device) {
if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__
/**
* fetch devices for user
*
- * @param Tinebase_Model_FullUser $user
+ * @param string $userId
*/
- protected function _getDevicesForUser($user)
+ protected function _getDevicesForUser($userId)
{
$deviceBackend = new ActiveSync_Backend_Device();
$deviceFilter = new ActiveSync_Model_DeviceFilter(array(
- array('field' => 'owner_id', 'operator' => 'equals', 'value' => $user->getId())
+ array('field' => 'owner_id', 'operator' => 'equals', 'value' => $userId)
));
$devices = $deviceBackend->search($deviceFilter);
return $devices;
$pastPersistentExceptionEvents = new Tinebase_Record_RecordSet('Calendar_Model_Event');
$futurePersistentExceptionEvents = new Tinebase_Record_RecordSet('Calendar_Model_Event');
foreach ($persistentExceptionEvents as $persistentExceptionEvent) {
- $persistentExceptionEvent->dtstart->isLater($_event->dtstart) ? $futurePersistentExceptionEvents->addRecord($persistentExceptionEvent) : $pastPersistentExceptionEvents->addRecord($persistentExceptionEvent);
+ $persistentExceptionEvent->getOriginalDtStart()->isLater($_event->dtstart) ?
+ $futurePersistentExceptionEvents->addRecord($persistentExceptionEvent) :
+ $pastPersistentExceptionEvents->addRecord($persistentExceptionEvent);
}
// update baseEvent
'samsunggtn7000', // Samsung Galaxy Note
'samsunggti9300', // Samsung Galaxy S-3
);
-
+
+ /**
+ * folder id which is currenttly synced
+ *
+ * @var string
+ */
+ protected $_syncFolderId = null;
+
/**
* (non-PHPdoc)
* @see ActiveSync_Frontend_Abstract::__construct()
case 'attendee':
if ($this->_device->devicetype === Syncroton_Model_Device::TYPE_IPHONE &&
- $entry->container_id !== $this->_getDefaultContainerId()) {
+ $this->_syncFolderId !== $this->_getDefaultContainerId()) {
continue;
}
} else {
if ($tine20Property === 'attendee' && $entry &&
$this->_device->devicetype === Syncroton_Model_Device::TYPE_IPHONE &&
- $entry->container_id !== $this->_getDefaultContainerId()) {
+ $this->_syncFolderId !== $this->_getDefaultContainerId()) {
// keep attendees as the are / they were not sent to the device before
} else {
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(
case 'attendee':
if ($entry &&
$this->_device->devicetype === Syncroton_Model_Device::TYPE_IPHONE &&
- $entry->container_id !== $this->_getDefaultContainerId()) {
+ $this->_syncFolderId !== $this->_getDefaultContainerId()) {
// keep attendees as the are / they were not sent to the device before
continue;
}
$containerId = Tinebase_Core::getPreference('ActiveSync')->{$this->_defaultFolder};
$container = Tinebase_Container::getInstance()->getContainerById($containerId);
}
+
+ $this->_syncFolderId = $container->getId();
Calendar_Controller_MSEventFacade::getInstance()->assertEventFacadeParams($container, false);
}
}
$this->setTableVersion('cal_events', 11);
$this->setApplicationVersion('Calendar', '8.10');
}
+
+ /**
+ * force activesync calendar resync for iOS devices
+ */
+ public function update_10()
+ {
+ $deviceBackend = new ActiveSync_Backend_Device();
+ $usersWithiPhones = $deviceBackend->search(new ActiveSync_Model_DeviceFilter(array(
+ 'devicetype' => 'iphone'
+ )), NULL, 'owner_id');
+
+ $activeSyncController = ActiveSync_Controller::getInstance();
+ foreach($usersWithiPhones as $userId) {
+ $activeSyncController->resetSyncForUser($userId, 'Calendar');
+ }
+
+ $this->setApplicationVersion('Calendar', '8.11');
+ }
}
<application>
<name>Calendar</name>
<!-- gettext('Calendar') -->
- <version>8.10</version>
+ <version>8.11</version>
<order>15</order>
<status>enabled</status>
<tables>