0013226: DemoData creation failed
authormmannigel <m.mannigel@metaways.de>
Fri, 16 Jun 2017 16:37:29 +0000 (18:37 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 19 Jun 2017 08:42:30 +0000 (10:42 +0200)
https://forge.tine20.org/view.php?id=13226

Change-Id: I15c99916537d247e75b57d39769bc30291b5bfe5
Reviewed-on: http://gerrit.tine20.com/customers/4890
Reviewed-by: Michael Spahn <m.spahn@metaways.de>
Tested-by: Jenkins CI (http://ci.tine20.com/)
tine20/Crm/Setup/DemoData.php

index c028a72..18a073b 100644 (file)
@@ -320,9 +320,15 @@ class Crm_Setup_DemoData extends Tinebase_Setup_DemoData_Abstract
         $users = $contactController->search($filter);
         
         $userids = $users->getId();
+
         
         // remove admin user
-        $users->removeRecord($users->getById(Tinebase_Core::getUser()->contact_id));
+        $currentUser = $users->getById(Tinebase_Core::getUser()->contact_id);
+
+        if ($currentUser) {
+            $users->removeRecord($currentUser);
+        }
+        
         $userCount = $users->count();
         
         $lastOrgName = NULL;