Merge branch 'pu/2013.10-caldavimport' into 2014.09
authorPhilipp Schüle <p.schuele@metaways.de>
Thu, 16 Oct 2014 08:34:51 +0000 (10:34 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 16 Oct 2014 08:34:51 +0000 (10:34 +0200)
Conflicts:
tests/tine20/TestServer.php
tine20/Calendar/Import/CalDav/Client.php

Change-Id: I5d6b66c9fc4b84ef72c631738e628808aec43e1c

1  2 
tests/tine20/Calendar/JsonTests.php
tine20/Calendar/Convert/Event/VCalendar/Abstract.php
tine20/Calendar/Frontend/WebDAV/Event.php
tine20/Calendar/Import/CalDav/Client.php
tine20/Tinebase/Auth/CredentialCache.php

Simple merge
@@@ -58,9 -58,14 +58,14 @@@ class Calendar_Frontend_WebDAV_Event ex
              $this->_event = ($pos = strpos($this->_event, '.')) === false ? $this->_event : substr($this->_event, 0, $pos);
          }
          
-         list($backend, $version) = Calendar_Convert_Event_VCalendar_Factory::parseUserAgent($_SERVER['HTTP_USER_AGENT']);
+         if (isset($_SERVER['HTTP_USER_AGENT'])) {
+             list($backend, $version) = Calendar_Convert_Event_VCalendar_Factory::parseUserAgent($_SERVER['HTTP_USER_AGENT']);
+         } else {
+             $backend = Calendar_Convert_Event_VCalendar_Factory::CLIENT_GENERIC;
+             $version = null;
+         }
          
 -        $this->_assertEventFacadeParams($this->_container);
 +        Calendar_Controller_MSEventFacade::getInstance()->assertEventFacadeParams($this->_container);
          
          $this->_converter = Calendar_Convert_Event_VCalendar_Factory::factory($backend, $version);
      }
@@@ -33,14 -33,11 +33,18 @@@ class Calendar_Import_CalDav_Client ext
      protected $webdavFrontend = 'Calendar_Frontend_WebDAV_Event';
      protected $_uuidPrefix = '';
      
+     protected $_enforceContainerName = null;
+     protected $_calToImport = null;
+     protected $_allowDuplicateEvents = false;
+     
      /**
 +     * record backend
 +     * 
 +     * @var Tinebase_Backend_Sql_Abstract
 +     */
 +    protected $_recordBackend = null;
 +    
 +    /**
       * skip those ics
       * 
       * TODO move to config
      {
          parent::__construct($a);
          
+         $this->_enforceContainerName = $forceContainerByName;
+         if (isset($a['calenderUri'])) {
+             $this->calendarHomeSet = $a['calenderUri'];
+             //$this->calendarICSs = array($a['calenderUri']);
+             $this->calendars = array(
+                 $a['calenderUri'] => array(
+                     'displayname' => $forceContainerByName
+                     // @todo add more properties?
+                 )
+             );
+         }
+         
+         if (isset($a['allowDuplicateEvents'])) {
+             $this->_allowDuplicateEvents = $a['allowDuplicateEvents'];
+         }
          $flavor = 'Calendar_Import_CalDav_Decorator_' . $flavor;
          $this->decorator = new $flavor($this);
 +        $this->_recordBackend = Tinebase_Core::getApplicationInstance($this->appName, $this->modelName)->getBackend();
      }
      
      public function findAllCalendars()
                  
              } else {
                  try {
-                     $this->_recordBackend->checkETag($data['id'], $data['etag']);
-                     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' '
-                             . ' Ignoring delegated event from another container/organizer: ' . $data['id']);
-                     continue;
+                     if (! $this->_allowDuplicateEvents) {
 -                        $recordBackend->checkETag($data['id'], $data['etag']);
++                        $this->_recordBackend->checkETag($data['id'], $data['etag']);
+                         if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' '
+                                 . ' Ignoring event from another container/organizer: ' . $data['id']);
+                         continue;
+                     }
                  } catch (Tinebase_Exception_NotFound $tenf) {
                      if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' '
                              . ' Found new record: ' . $data['id']);