X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FttUser.class.php;h=5e359cd213c1dd954f22f35b2f09f06e4fc06925;hb=f5d19e5d5fd205d81367ab2c82d41c154cad50ff;hp=73393c0ac943bd8305c7f36d86092c6d7ff807f8;hpb=884b152e088f23cfec4342db48fb9924cc647cee;p=timetracker.git
diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php
index 73393c0a..5e359cd2 100644
--- a/WEB-INF/lib/ttUser.class.php
+++ b/WEB-INF/lib/ttUser.class.php
@@ -523,7 +523,7 @@ class ttUser {
// - subgroup must ve valid;
// - user should be a member of it.
function checkBehalfId() {
- if (!$this->behalf_group_id) {
+ if (!$this->behalfGroup) {
// Checking user from home group.
$options = array('status'=>ACTIVE,'max_rank'=>$this->rank-1);
$users = $this->getUsers($options);
@@ -533,7 +533,7 @@ class ttUser {
}
} else {
// Checking user from a subgroup.
- $group_id = $this->behalf_group_id;
+ $group_id = $this->behalfGroup->id;
if (!$this->isSubgroupValid($group_id))
return false;
@@ -556,11 +556,10 @@ class ttUser {
// In this case we still allow access to charts, but set behalf_id to someone else.
// Another example: working in a subgroup on behalf of someone else.
function adjustBehalfId() {
- $group_id = $this->behalf_group_id ? $this->behalf_group_id : $this->group_id;
- $rank = $this->getMaxRankForGroup($group_id);
+ $rank = $this->getMaxRankForGroup($this->getGroup());
// Adjust to first found user in group.
- $options = array('group_id'=>$group_id,'status'=>ACTIVE,'max_rank'=>$rank);
+ $options = array('status'=>ACTIVE,'max_rank'=>$rank);
$users = $this->getUsers($options);
foreach($users as $one_user) {
// Fake loop to access first element.
@@ -746,7 +745,7 @@ class ttUser {
$user_part .= ' '.$i18n->get('label.on_behalf').' '.htmlspecialchars($this->behalf_name).'';
}
if ($this->behalf_group_id) {
- $user_part .= ', '.$i18n->get('label.on_behalf').' '.htmlspecialchars($this->behalf_group_name).'';
+ $user_part .= ', '.htmlspecialchars($this->behalf_group_name).'';
} else {
if ($this->group_name) // Note: we did not require group names in the past.
$user_part .= ', '.$this->group_name;
@@ -786,7 +785,7 @@ class ttUser {
$this->behalfGroup = new ttGroup($this->behalf_group_id, $this->org_id);
- // Adjust on behalf user.
+ // Adjust on behalf user to first found user in subgroup.
$this->adjustBehalfId();
return;
}