]> wagnertech.de Git - timetracker.git/blobdiff - WEB-INF/lib/ttRegistrator.class.php
Refactored admin_options.php to use ttAdmin instance.
[timetracker.git] / WEB-INF / lib / ttRegistrator.class.php
index 3ac6166d32bc06096a9963b5e489e4277e0f03ed..71f49e690b32e53b304b904d6b1e2e87f89ece90 100644 (file)
@@ -81,7 +81,7 @@ class ttRegistrator {
 
   // The register function registers a user in Time Tracker.
   function register() {
-    if ($this->err->yes()) return; // There are errors, do not proceed.
+    if ($this->err->yes()) return false; // There are errors, do not proceed.
 
     global $i18n;
 
@@ -89,30 +89,33 @@ class ttRegistrator {
     if (ttUserHelper::getUserByLogin($this->login)) {
       // User login already exists.
       $this->err->add($i18n->getKey('error.user_exists'));
-      return;
+      return false;
     }
 
     // Create a new group.
     $this->group_id = $this->createGroup();
     if (!$this->group_id) {
       $this->err->add($i18n->getKey('error.db'));
-      return;
+      return false;
     }
 
     import('ttRoleHelper');
     if (!ttRoleHelper::createPredefinedRoles($this->group_id, $this->lang)) {
       $err->add($i18n->getKey('error.db'));
-      return;
+      return false;
     }
     $this->role_id = ttRoleHelper::getTopManagerRoleID();
     $this->user_id = $this->createUser();
 
     if (!$this->user_id) {
       $err->add($i18n->getKey('error.db'));
-      return;
+      return false;
     }
 
-    $this->setCreatedBy($this->user_id);
+    if (!$this->setCreatedBy($this->user_id))
+      return false;
+
+    return true;
   }
 
   // The createGroup function creates a group in Time Tracker as part