X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/d5923832a32b1f43cbc6c5d74bbd064888761c80..75345c7086761ea68d7e75fbffeaef64a3642fdd:/WEB-INF/lib/ttReportHelper.class.php diff --git a/WEB-INF/lib/ttReportHelper.class.php b/WEB-INF/lib/ttReportHelper.class.php index ceaee4b0..a64bb870 100644 --- a/WEB-INF/lib/ttReportHelper.class.php +++ b/WEB-INF/lib/ttReportHelper.class.php @@ -639,9 +639,10 @@ class ttReportHelper { $org_id = $user->org_id; if ($time_log_ids) { - $sql = "update tt_log l". - // TODO: inner join does not work properly for de-assignment. Improve. - // " inner join tt_timesheets ts on (ts.id = $timesheet_id and ts.approve_status is null)". + if ($timesheet_id) + $inner_join = " inner join tt_timesheets ts on (ts.id = $timesheet_id and ts.approve_status is null)"; + + $sql = "update tt_log l $inner_join". " set l.timesheet_id = ".$mdb2->quote($timesheet_id). " where l.id in(".join(', ', $time_log_ids).") and l.user_id = $user_id and l.group_id = $group_id and l.org_id = $org_id"; $affected = $mdb2->exec($sql);