update group members even if a user could not be found
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 8 Sep 2014 20:38:51 +0000 (22:38 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 11 Sep 2014 08:38:00 +0000 (10:38 +0200)
... in group import/update

+ improve logging in import abstract

Change-Id: I7ae266af30575ad08f121b454181a28fdaa02832
Reviewed-on: http://gerrit.tine20.com/customers/1108
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Admin/Import/Group/Csv.php
tine20/Tinebase/Import/Abstract.php

index c1d71cb..66f10b2 100644 (file)
@@ -110,7 +110,14 @@ class Admin_Import_Group_Csv extends Tinebase_Import_Csv_Abstract
                 $user = $this->_userRecords->filter('name', $userName)->getFirstRecord();
                 
                 if (! $user) {
-                    $user = Tinebase_User::getInstance()->getUserByLoginName($userName);
+                    try {
+                        $user = Tinebase_User::getInstance()->getUserByLoginName($userName);
+                    } catch (Tinebase_Exception_NotFound $tenf) {
+                        if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
+                                . ' Skipping user ' . $userName);
+                        Tinebase_Exception::log($tenf);
+                        continue;
+                    }
                     $this->_userRecords->addRecord($user);
                 }
                 
index 3546a99..bf66d5c 100644 (file)
@@ -904,8 +904,7 @@ abstract class Tinebase_Import_Abstract implements Tinebase_Import_Interface
      */
     protected function _handleImportException(Exception $e, $recordIndex, $record = null, $allowToResolveDuplicates = true)
     {
-        if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' ' . $e->getMessage());
-        if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . $e->getTraceAsString());
+        Tinebase_Exception::log($e);
         
         if ($e instanceof Tinebase_Exception_Duplicate) {
             $exception = $this->_handleDuplicateExceptions($e, $recordIndex, $record, $allowToResolveDuplicates);