]> wagnertech.de Git - timetracker.git/blobdiff - WEB-INF/lib/ttUser.class.php
Introduced ttGroup class to store attributes of on behalf group.
[timetracker.git] / WEB-INF / lib / ttUser.class.php
index 8c4595dbb5d757202d33878e91c01712a885c343..ccd1f961e46cc0374797f5306067089ef22a3266 100644 (file)
@@ -28,6 +28,7 @@
 
 import('ttConfigHelper');
 import('ttGroupHelper');
+import('ttGroup');
 
 class ttUser {
   var $login = null;            // User login.
@@ -74,6 +75,8 @@ class ttUser {
   var $first_unit_threshold = 0;// Threshold for 1st unit for Work units plugin.
   var $unit_totals_only = 0;    // Totals only option for the Work units plugin.
 
+  var $behalfGroup = null;      // A ttGroup instance with on behalf group attributes.
+
   // Constructor.
   function __construct($login, $id = null) {
     if (!$login && !$id) {
@@ -150,13 +153,15 @@ class ttUser {
       
       // Set "on behalf" id and name (user).
       if (isset($_SESSION['behalf_id'])) {
-          $this->behalf_id = $_SESSION['behalf_id'];
-          $this->behalf_name = $_SESSION['behalf_name'];
+        $this->behalf_id = $_SESSION['behalf_id'];
+        $this->behalf_name = $_SESSION['behalf_name'];
       }
       // Set "on behalf" id and name (group).
       if (isset($_SESSION['behalf_group_id'])) {
-          $this->behalf_group_id = $_SESSION['behalf_group_id'];
-          $this->behalf_group_name = $_SESSION['behalf_group_name'];
+        $this->behalf_group_id = $_SESSION['behalf_group_id'];
+        $this->behalf_group_name = $_SESSION['behalf_group_name'];
+
+        $this->behalfGroup = new ttGroup($this->behalf_group_id, $this->org_id);
       }
     }
   }
@@ -714,6 +719,9 @@ class ttUser {
     $this->behalf_group_id = $group_id;
     $this->behalf_group_name = $onBehalfGroupName;
 
+    unset($this->behalfGroup);
+    $this->behalfGroup = new ttGroup($this->behalf_group_id, $this->org_id);
+
     // Adjust on behalf user.
     $this->adjustBehalfId();
     return;