]> wagnertech.de Git - timetracker.git/blobdiff - WEB-INF/lib/ttTimesheetHelper.class.php
A bit more work in progress on timesheet view.
[timetracker.git] / WEB-INF / lib / ttTimesheetHelper.class.php
index 056fc6859ab3c44c4f2666d879526f850999c3ff..49808359a19bdd6a740f461a9d8195f659f29ed2 100644 (file)
@@ -212,10 +212,12 @@ class ttTimesheetHelper {
     $group_id = $user->getGroup();
     $org_id = $user->org_id;
 
     $group_id = $user->getGroup();
     $org_id = $user->org_id;
 
-    if ($user->isClient()) $client_part = "and client_id = $user->client_id";
+    if ($user->isClient()) $client_part = "and ts.client_id = $user->client_id";
 
 
-    $sql = "select * from tt_timesheets".
-      " where id = $timesheet_id and group_id = $group_id and org_id = $org_id $client_part and status is not null";
+    $sql = "select ts.id, ts.user_id, u.name as user_name, ts.client_id, c.name as client_name, ts.name from tt_timesheets ts".
+      " left join tt_users u on (u.id = ts.user_id)".
+      " left join tt_clients c on (c.id = ts.client_id)".
+      " where ts.id = $timesheet_id and ts.group_id = $group_id and ts.org_id = $org_id $client_part and ts.status is not null";
     $res = $mdb2->query($sql);
     if (!is_a($res, 'PEAR_Error')) {
       if ($val = $res->fetchRow())
     $res = $mdb2->query($sql);
     if (!is_a($res, 'PEAR_Error')) {
       if ($val = $res->fetchRow())