FROM {related} r LEFT JOIN {tasks} t ON (r.related_task = t.task_id AND r.this_task = ? OR r.this_task = t.task_id AND r.related_task = ?) LEFT JOIN {list_status} s ON t.item_status = s.status_id LEFT JOIN {list_resolution} res ON t.resolution_reason = res.resolution_id WHERE t.task_id is NOT NULL AND is_duplicate = 0 AND ( t.mark_private = 0 OR ? = 1 ) ORDER BY t.task_id ASC', array($task_id, $task_id, $user->perms('manage_project'))); $related_cleaned = Flyspray::weedOutTasks($user, $db->fetchAllArray($sql)); $page->assign('related', $related_cleaned); $sql = $db->Query('SELECT t.*, r.*, s.status_name, res.resolution_name FROM {related} r LEFT JOIN {tasks} t ON r.this_task = t.task_id LEFT JOIN {list_status} s ON t.item_status = s.status_id LEFT JOIN {list_resolution} res ON t.resolution_reason = res.resolution_id WHERE is_duplicate = 1 AND r.related_task = ? ORDER BY t.task_id ASC', array($task_id)); $duplicates_cleaned = Flyspray::weedOutTasks($user, $db->fetchAllArray($sql)); $page->assign('duplicates', $duplicates_cleaned); $sql = $db->Query('SELECT * FROM {notifications} n LEFT JOIN {users} u ON n.user_id = u.user_id WHERE n.task_id = ?', array($task_id)); $page->assign('notifications', $db->fetchAllArray($sql)); $sql = $db->Query('SELECT * FROM {reminders} r LEFT JOIN {users} u ON r.to_user_id = u.user_id WHERE task_id = ? ORDER BY reminder_id', array($task_id)); $page->assign('reminders', $db->fetchAllArray($sql)); $page->pushTpl('details.tabs.tpl'); if ($user->perms('view_comments') || $proj->prefs['others_view'] || $user->isAnon() && $task_details['task_token'] && Get::val('task_token') == $task_details['task_token']) { $page->pushTpl('details.tabs.comment.tpl');