From: Nik Okuntseff Date: Sat, 1 Dec 2018 21:30:52 +0000 (+0000) Subject: Improved clients.php to support subgroups. X-Git-Tag: timetracker_1.19-1~504 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=884b152e088f23cfec4342db48fb9924cc647cee;p=timetracker.git Improved clients.php to support subgroups. --- diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index 0db272ff..73393c0a 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -230,11 +230,14 @@ class ttUser { $result = array(); $mdb2 = getConnection(); - $group_id = $this->behalf_group_id ? $this->behalf_group_id : $this->group_id; + $group_id = $this->getGroup(); + $org_id = $this->org_id; + $user_id = $this->getUser(); + // Do a query with inner join to get assigned projects. - $sql = "select p.id, p.name, p.description, p.tasks, upb.rate from tt_projects p - inner join tt_user_project_binds upb on (upb.user_id = ".$this->getUser()." and upb.project_id = p.id and upb.status = 1) - where p.group_id = $group_id and p.status = 1 order by p.name"; + $sql = "select p.id, p.name, p.description, p.tasks, upb.rate from tt_projects p". + " inner join tt_user_project_binds upb on (upb.user_id = $user_id and upb.project_id = p.id and upb.status = 1)". + " where p.group_id = $group_id and p.org_id = $org_id and p.status = 1 order by p.name"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { while ($val = $res->fetchRow()) { @@ -288,9 +291,12 @@ class ttUser { $mdb2 = getConnection(); + $group_id = $this->getGroup(); + $org_id = $this->org_id; + // Get active clients for group. $clients = array(); - $sql = "select id, name, address, projects from tt_clients where group_id = $this->group_id and status = 1"; + $sql = "select id, name, address, projects from tt_clients where group_id = $group_id and org_id = $org_id and status = 1"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { while ($val = $res->fetchRow()) { diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 7c66412a..111e83dd 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.29.4561 | Copyright © Anuko | +  Anuko Time Tracker 1.18.29.4562 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve}