handle missing keyfield config during export
authorPhilipp Schüle <p.schuele@metaways.de>
Wed, 23 Mar 2016 15:42:57 +0000 (16:42 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Wed, 30 Mar 2016 09:53:44 +0000 (11:53 +0200)
Change-Id: I50553b82ce1b726f9927445325c6bb716a8288d4
Reviewed-on: http://gerrit.tine20.com/customers/2967
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/Export/Abstract.php

index 636fcc7..fab2f0e 100644 (file)
@@ -476,10 +476,17 @@ abstract class Tinebase_Export_Abstract
      */
     protected function _getResolvedKeyfield($_property, $_keyfield, $_application)
     {
-         $i18nApplication = Tinebase_Translation::getTranslation($_application);
-         $config = Tinebase_Config::getAppConfig($_application);
-         $result = $config->get($_keyfield)->records->getById($_property);
-         return isset($result->value) ? $i18nApplication->translate($result->value) : $_property;
+        $i18nApplication = Tinebase_Translation::getTranslation($_application);
+        $config = Tinebase_Config::getAppConfig($_application);
+
+        $keyfieldConfig = $config->get($_keyfield);
+        if ($keyfieldConfig) {
+            $result = $keyfieldConfig->records->getById($_property);
+        } else {
+            if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' '
+                . ' Could not find keyfield: ' . $_keyfield);
+        }
+        return isset($result) && isset($result->value) ? $i18nApplication->translate($result->value) : $_property;
     }
     
     /**