- $sql = "select u.*, r.name as role_name, r.rank from tt_users u left join tt_roles r on (u.role_id = r.id) where u.team_id = $user->team_id and u.status = 1 order by upper(u.name)";
+ $sql = "select u.*, r.name as role_name, r.rank from tt_users u left join tt_roles r on (u.role_id = r.id) where u.group_id = $user->group_id and u.status = 1 order by upper(u.name)";
else
else
- $sql = "select id, name from tt_users where team_id = $user->team_id and status = 1 order by upper(name)";
+ $sql = "select id, name from tt_users where group_id = $user->group_id and status = 1 order by upper(name)";
- $sql = "select u.id, u.role_id from tt_users u left join tt_roles r on (u.role_id = r.id) where u.id = $user_id and u.team_id = $user->team_id and u.status = 1 and r.rank < $user->rank";
+ // Obtain role id for the user we are swapping ourselves with.
+ $sql = "select u.id, u.role_id from tt_users u left join tt_roles r on (u.role_id = r.id) where u.id = $user_id and u.group_id = $user->group_id and u.status = 1 and r.rank < $user->rank";
- $sql = "select u.id, u.name, r.rank, r.rights from tt_users u left join tt_roles r on (u.role_id = r.id) where u.team_id = $user->team_id and u.status = 1 and r.rank < $user->rank order by upper(u.name)";
+ $sql = "select u.id, u.name, r.rank, r.rights from tt_users u left join tt_roles r on (u.role_id = r.id) where u.group_id = $user->group_id and u.status = 1 and r.rank < $user->rank order by upper(u.name)";
$res = $mdb2->query($sql);
$user_list = array();
if (is_a($res, 'PEAR_Error'))
return false;
while ($val = $res->fetchRow()) {
$res = $mdb2->query($sql);
$user_list = array();
if (is_a($res, 'PEAR_Error'))
return false;
while ($val = $res->fetchRow()) {
- $isClient = in_array('track_own_time', explode(',', $val['rights'])) ? 0 : 1; // Clients do not have data entry right.
+ $isClient = in_array('track_own_time', explode(',', $val['rights'])) ? 0 : 1; // Clients do not have track_own_time right.
// The getInactiveUsers obtains all inactive users in a given team.
}
// The getInactiveUsers obtains all inactive users in a given team.
- static function getInactiveUsers($team_id, $all_fields = false) {
+ static function getInactiveUsers($group_id, $all_fields = false) {
$mdb2 = getConnection();
if ($all_fields)
$mdb2 = getConnection();
if ($all_fields)
- $sql = "select u.*, r.name as role_name from tt_users u left join tt_roles r on (u.role_id = r.id) where u.team_id = $team_id and u.status = 0 order by upper(u.name)";
+ $sql = "select u.*, r.name as role_name from tt_users u left join tt_roles r on (u.role_id = r.id) where u.group_id = $group_id and u.status = 0 order by upper(u.name)";
else
else
- $sql = "select id, name from tt_users where team_id = $team_id and status = 0 order by upper(name)";
+ $sql = "select id, name from tt_users where group_id = $group_id and status = 0 order by upper(name)";
- $sql = "select id, name, description, rank, rights from tt_roles where team_id = $user->team_id and rank < $user->rank and status = 1 order by rank";
+ $sql = "select id, name, description, rank, rights from tt_roles where group_id = $user->group_id and rank < $user->rank and status = 1 order by rank";
- $sql = "select id, name, description, rank, rights from tt_roles where team_id = $user->team_id and rank < $user->rank and status = 0 order by rank";
+ $sql = "select id, name, description, rank, rights from tt_roles where group_id = $user->group_id and rank < $user->rank and status = 0 order by rank";
// getUserToProjectBinds - obtains all user to project binds for a team.
}
// getUserToProjectBinds - obtains all user to project binds for a team.
- static function getUserToProjectBinds($team_id) {
+ static function getUserToProjectBinds($group_id) {
$mdb2 = getConnection();
$result = array();
$mdb2 = getConnection();
$result = array();
- $sql = "select * from tt_user_project_binds where user_id in (select id from tt_users where team_id = $team_id) order by user_id, status, project_id";
+ $sql = "select * from tt_user_project_binds where user_id in (select id from tt_users where group_id = $group_id) order by user_id, status, project_id";