improves duplicate exception logging in import
authorPhilipp Schüle <p.schuele@metaways.de>
Mon, 15 Aug 2016 09:24:51 +0000 (11:24 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 15 Aug 2016 10:10:09 +0000 (12:10 +0200)
... and fixes empty tag id handling

Change-Id: I15459a3a82c0bb60f8aa7211cab16270e28b9fbd
Reviewed-on: http://gerrit.tine20.com/customers/3435
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/Controller/Record/Abstract.php
tine20/Tinebase/Import/Abstract.php

index 1a19aa9..3c30305 100644 (file)
@@ -636,15 +636,15 @@ abstract class Tinebase_Controller_Record_Abstract
      * @param Exception $e
      * @throws Exception
      * 
-     * @todo invent hooking mechanism for database/backend independant exception handling (like lock timeouts)
+     * @todo invent hooking mechanism for database/backend independent exception handling (like lock timeouts)
      */
     protected function _handleRecordCreateOrUpdateException(Exception $e)
     {
         Tinebase_TransactionManager::getInstance()->rollBack();
         
-        if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' ' . $e->getMessage());
-        if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . $e->getTraceAsString());
-        
+        if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__
+            . ' Exception: ' . $e->getMessage());
+
         if ($e instanceof Zend_Db_Statement_Exception && preg_match('/Lock wait timeout exceeded/', $e->getMessage())) {
             throw new Tinebase_Exception_Backend_Database_LockTimeout($e->getMessage());
         }
index db6d5f2..6c8ca4d 100644 (file)
@@ -843,7 +843,7 @@ abstract class Tinebase_Import_Abstract implements Tinebase_Import_Interface
         
         $tag = NULL;
         
-        if (isset($_tagData['id'])) {
+        if (isset($_tagData['id']) && ! empty($_tagData['id'])) {
             try {
                 $tag = Tinebase_Tags::getInstance()->get($_tagData['id']);
                 return $tag;
@@ -1105,11 +1105,11 @@ abstract class Tinebase_Import_Abstract implements Tinebase_Import_Interface
      */
     protected function _handleImportException(Exception $e, $recordIndex, $record = null, $allowToResolveDuplicates = true)
     {
-        Tinebase_Exception::log($e);
-        
         if ($e instanceof Tinebase_Exception_Duplicate) {
             $exception = $this->_handleDuplicateExceptions($e, $recordIndex, $record, $allowToResolveDuplicates);
         } else {
+            Tinebase_Exception::log($e);
+
             $this->_importResult['failcount']++;
             $exception = array(
                 'code'         => $e->getCode(),