Merge branch '2015.11' into 2015.11-develop
authorPhilipp Schüle <p.schuele@metaways.de>
Thu, 29 Sep 2016 08:47:20 +0000 (10:47 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 29 Sep 2016 08:47:20 +0000 (10:47 +0200)
Change-Id: I4f84471511ea4b874dbd3f6db58c73b3bba43260

tests/tine20/Calendar/Frontend/ActiveSyncTest.php
tine20/Addressbook/Config.php
tine20/Addressbook/Import/Csv.php
tine20/Calendar/Frontend/ActiveSync.php

index ed8aaa5..0988dc0 100644 (file)
@@ -436,18 +436,6 @@ Zeile 3</AirSyncBase:Data>
     </Sync>';
 
     /**
-     * Runs the test methods of this class.
-     *
-     * @access public
-     * @static
-     */
-    public static function main()
-    {
-        $suite  = new PHPUnit_Framework_TestSuite('Tine 2.0 ActiveSync Controller Calendar Tests');
-        PHPUnit_TextUI_TestRunner::run($suite);
-    }
-    
-    /**
      * (non-PHPdoc)
      * @see ActiveSync/ActiveSync_TestCase::setUp()
      */
@@ -1295,7 +1283,7 @@ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAFAAMA
 
         // assert created group & groupmembers
         $syncrotonEventtoUpdate = $controller->getEntry(new Syncroton_Model_SyncCollection(array('collectionId' => $syncrotonFolder->serverId)), $serverId);
-        $this->assertCount(count($defaultUserGroupMembers) + 1, $syncrotonEventtoUpdate->attendees, 'groupmembers not resolved');
+        $this->assertCount(count($defaultUserGroupMembers) + 1, $syncrotonEventtoUpdate->attendees, 'groupmembers not resolved: ' . print_r($syncrotonEventtoUpdate->attendees, true));
         $this->assertCount(count($defaultUserGroupMembers) + 1, $syncrotonEventtoUpdate->exceptions[0]->attendees, 'groupmembers not resolved');
 
         // update event
index 036e362..dc24ad4 100644 (file)
  */
 class Addressbook_Config extends Tinebase_Config_Abstract
 {
+
+    /**
+     * contact nominatim during contact import
+     *
+     * @var string
+     */
+    const CONTACT_IMPORT_NOMINATIM = 'contactImportNominatim';
+
     /**
      * fields for contact record duplicate check
      * 
@@ -129,6 +137,16 @@ class Addressbook_Config extends Tinebase_Config_Abstract
                     ),
             )
         ),
+        self::CONTACT_IMPORT_NOMINATIM => array(
+            //_('Use Nominatim during contact import')
+            'label'                 => 'Use Nominatim during contact import',
+            'description'           => 'Use Nominatim during contact import',
+            'type'                  => 'bool',
+            'default'               => false,
+            'clientRegistryInclude' => false,
+            'setByAdminModule'      => true,
+            'setBySetupModule'      => true,
+        ),
     );
     
     /**
index adf8a30..aef860e 100644 (file)
@@ -48,9 +48,12 @@ class Addressbook_Import_Csv extends Tinebase_Import_Csv_Abstract
     public function __construct(array $_options = array())
     {
         parent::__construct($_options);
-        
-        // don't set geodata for imported contacts as this is too much traffic for the nominatim server
-        $this->_controller->setGeoDataForContacts(FALSE);
+
+        if (! Addressbook_Config::getInstance()->get(Addressbook_Config::CONTACT_IMPORT_NOMINATIM)) {
+            // don't set geodata for imported contacts as this might be too much traffic for the nominatim server
+            // TODO make this setting overwritable via import definition/options
+            $this->_controller->setGeoDataForContacts(FALSE);
+        }
         
         // get container id from default container if not set
         if (empty($this->_options['container_id'])) {
index 481d0f6..eea9321 100644 (file)
@@ -261,7 +261,7 @@ class Calendar_Frontend_ActiveSync extends ActiveSync_Frontend_Abstract implemen
         $syncrotonEvent = new Syncroton_Model_Event();
         
         foreach ($this->_mapping as $syncrotonProperty => $tine20Property) {
-            if (empty($entry->$tine20Property) && $entry->$tine20Property != '0' || count($entry->$tine20Property) === 0) {
+            if ((empty($entry->$tine20Property) && $entry->$tine20Property != '0') || count($entry->$tine20Property) === 0) {
                 continue;
             }
             
@@ -286,8 +286,7 @@ class Calendar_Frontend_ActiveSync extends ActiveSync_Frontend_Abstract implemen
                     if ($this->_device->devicetype === Syncroton_Model_Device::TYPE_IPHONE &&
                         // note: might comparing an integer with a string here (at least with pgsql)
                         $this->_syncFolderId       != $this->_getDefaultContainerId()) {
-                        
-                        continue;
+                        break;
                     }
                     
                     // fill attendee cache
@@ -557,7 +556,7 @@ class Calendar_Frontend_ActiveSync extends ActiveSync_Frontend_Abstract implemen
                 } else {
                     if ($tine20Property === 'attendee' && $entry &&
                         $this->_device->devicetype === Syncroton_Model_Device::TYPE_IPHONE &&
-                        $this->_syncFolderId       !== $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(
@@ -571,18 +570,17 @@ class Calendar_Frontend_ActiveSync extends ActiveSync_Frontend_Abstract implemen
             switch ($tine20Property) {
                 case 'alarms':
                     // handled after switch statement
-                    
                     break;
                     
                 case 'attendee':
                     if ($entry && 
                         $this->_device->devicetype === Syncroton_Model_Device::TYPE_IPHONE &&
-                        $this->_syncFolderId       !== $this->_getDefaultContainerId()) {
+                        $this->_syncFolderId       != $this->_getDefaultContainerId()) {
 
                         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(
                             __METHOD__ . '::' . __LINE__ . " keep attendees as the are / they were not sent to the device before ");
 
-                        continue;
+                        break;
                     }
 
                     $newAttendees = array();