performance improvements for Tinebase_Convert_Json
authorLars Kneschke <l.kneschke@metaways.de>
Sat, 20 Dec 2014 22:04:36 +0000 (23:04 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 29 Dec 2014 09:31:50 +0000 (10:31 +0100)
- skip hasGrant as Tinebase_Core::getApplicationInsatce calls hasGrant
anyway
- don't try to resolve id's of empty recordSets

Change-Id: I9c9ee43d9635948a4e8a28d3b118630e9b46ab08
Reviewed-on: http://gerrit.tine20.com/customers/1477
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/Convert/Json.php

index f137ebb..0ad6df5 100644 (file)
@@ -138,7 +138,7 @@ class Tinebase_Convert_Json implements Tinebase_Convert_Interface
      */
     public static function resolveMultipleIdFields($records, $resolveFields = NULL)
     {
-        if (! $records instanceof Tinebase_Record_RecordSet) {
+        if (! $records instanceof Tinebase_Record_RecordSet || !$records->count()) {
             return;
         }
         
@@ -180,15 +180,11 @@ class Tinebase_Convert_Json implements Tinebase_Convert_Interface
             $foreignIds = array_unique(array_merge($foreignIds, $records->{$field}));
         }
         
-        if (! Tinebase_Core::getUser()->hasRight(substr($foreignRecordClassName, 0, strpos($foreignRecordClassName, "_")), Tinebase_Acl_Rights_Abstract::RUN)) {
-            if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ 
-                . ' Not resolving ' . $foreignRecordClassName . ' records because user has no right to run app.');
-            return;
-        }
-        
         try {
             $controller = Tinebase_Core::getApplicationInstance($foreignRecordClassName);
         } catch (Tinebase_Exception_AccessDenied $tead) {
+            if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ 
+                . ' Not resolving ' . $foreignRecordClassName . ' records because user has no right to run app.');
             return;
         }