X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/237f5fae68a9410971ce1c4895a07fe2fa0fbd52..dae63a256124376c8379a7d366d6ab885be22ac6:/WEB-INF/lib/ttGroupHelper.class.php diff --git a/WEB-INF/lib/ttGroupHelper.class.php b/WEB-INF/lib/ttGroupHelper.class.php index 4bc71648..05a31562 100644 --- a/WEB-INF/lib/ttGroupHelper.class.php +++ b/WEB-INF/lib/ttGroupHelper.class.php @@ -34,9 +34,10 @@ class ttGroupHelper { // The getGroupName function returns group name. static function getGroupName($group_id) { + global $user; $mdb2 = getConnection(); - $sql = "select name from tt_groups where id = $group_id and (status = 1 or status = 0)"; + $sql = "select name from tt_groups where id = $group_id and org_id = $user->org_id and (status = 1 or status = 0)"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { @@ -637,19 +638,22 @@ class ttGroupHelper { } // The getUsersForClient obtains all active and inactive users in a group that are relevant to a client. - static function getUsersForClient() { + static function getUsersForClient($options) { global $user; $mdb2 = getConnection(); $group_id = $user->getGroup(); $org_id = $user->org_id; + if (isset($options['status'])) + $where_part = 'where u.status = '.(int)$options['status']; + else + $where_part = 'where u.status is not null'; + $sql = "select u.id, u.name from tt_user_project_binds upb". " inner join tt_client_project_binds cpb on (upb.project_id = cpb.project_id and cpb.client_id = $user->client_id)". " inner join tt_users u on (u.id = upb.user_id and u.group_id = $group_id and u.org_id = $org_id)". - " where (u.status = 1 or u.status = 0)". - " group by u.id". - " order by upper(u.name)"; + " $where_part group by u.id order by upper(u.name)"; $res = $mdb2->query($sql); $user_list = array(); if (is_a($res, 'PEAR_Error'))