0012570: ActiveSync: creating recur exceptions with group attendee creates a contact
authorCornelius Weiß <c.weiss@metaways.de>
Wed, 25 Jan 2017 13:07:42 +0000 (14:07 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Tue, 31 Jan 2017 14:44:29 +0000 (15:44 +0100)
* client has list_id and _not_ group_id

Change-Id: Ic0e375086588b8a2782698c9504e70190166b3e1
Reviewed-on: http://gerrit.tine20.com/customers/4133
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tests/tine20/Calendar/Frontend/ActiveSyncTest.php
tine20/Calendar/Model/Attender.php

index 0988dc0..33bcb02 100644 (file)
@@ -1276,7 +1276,7 @@ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAMA
         // create event with default user group (without explicit groupmembers)
         $xml = new SimpleXMLElement(str_replace(array(
             'usersgroupid',
-        ), $defaultUserGroup->getId(), file_get_contents(__DIR__ . '/files/event_with_group_attendee.xml')));
+        ), $defaultUserGroup->list_id, file_get_contents(__DIR__ . '/files/event_with_group_attendee.xml')));
         $syncrotonEvent = new Syncroton_Model_Event($xml->Collections->Collection->Commands->Change[0]->ApplicationData);
         $controller = Syncroton_Data_Factory::factory($this->_class, $this->_getDevice(Syncroton_Model_Device::TYPE_IPHONE), Tinebase_DateTime::now());
         $serverId = $controller->createEntry($syncrotonFolder->serverId, $syncrotonEvent);
@@ -1296,5 +1296,6 @@ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAMA
         $updatedSyncrotonEvent = $controller->getEntry(new Syncroton_Model_SyncCollection(array('collectionId' => $syncrotonFolder->serverId)), $serverId);
         $this->assertCount(count($defaultUserGroupMembers) + 1, $updatedSyncrotonEvent->attendees, 'groupmembers not resolved');
         $this->assertCount(count($defaultUserGroupMembers) + 1, $updatedSyncrotonEvent->exceptions[0]->attendees, 'groupmembers not resolved');
+
     }
 }
index d9bb0bd..34ba987 100644 (file)
@@ -446,10 +446,10 @@ class Calendar_Model_Attender extends Tinebase_Record_Abstract
                 // does a list with this id exist?
                 if (! $attendeeId) {
                     try {
-                        $group = Tinebase_Group::getInstance()->getGroupById($newAttendee['email']);
-                        if ($group) {
+                        $list = Addressbook_Controller_List::getInstance()->get($newAttendee['email']);
+                        if ($list) {
                             $newAttendee['userType'] = Calendar_Model_Attender::USERTYPE_GROUP;
-                            $attendeeId = $group->getId();
+                            $attendeeId = $list->getId();
                         }
                     } catch (Exception $e) {
                         // do nothing
@@ -613,9 +613,16 @@ class Calendar_Model_Attender extends Tinebase_Record_Abstract
             if ($groupAttender->user_id instanceof Addressbook_Model_List) {
                 $listId = $groupAttender->user_id->getId();
             } else if ($groupAttender->user_id !== NULL) {
-                $group = Tinebase_Group::getInstance()->getGroupById($groupAttender->user_id);
-                if (!empty($group->list_id)) {
-                    $listId = $group->list_id;
+                try {
+                    $list = Addressbook_Controller_List::getInstance()->get($groupAttender->user_id);
+                    $listId = $list->getId();
+                } catch (Exception $e) {
+                    // lets try group
+                    $group = Tinebase_Group::getInstance()->getGroupById($groupAttender->user_id);
+                    if (!empty($group->list_id)) {
+                        Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__  . ' fixme: depricated use of  group id');
+                        $listId = $group->list_id;
+                    }
                 }
             } else {
                 if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__