@ -90,7 +90,11 @@ class ProjectsController < ApplicationController
@trackers=@project.trackers
@open_issues_by_tracker=Issue.count(:group=>:tracker,:joins=>"INNER JOIN #{IssueStatus.table_name} ON #{IssueStatus.table_name}.id = #{Issue.table_name}.status_id",:conditions=>["project_id=? and #{IssueStatus.table_name}.is_closed=?",@project.id,false])
sql="SELECT #{sql_select}, tyear, tmonth, tweek, SUM(hours) AS hours"
sql<<" FROM #{TimeEntry.table_name} LEFT JOIN #{Issue.table_name} ON #{TimeEntry.table_name}.issue_id = #{Issue.table_name}.id"
sql<<" WHERE #{TimeEntry.table_name}.project_id = %s"%@project.id
sql<<" FROM #{TimeEntry.table_name}"
sql<<" LEFT JOIN #{Issue.table_name} ON #{TimeEntry.table_name}.issue_id = #{Issue.table_name}.id"
sql<<" LEFT JOIN #{Project.table_name} ON #{TimeEntry.table_name}.project_id = #{Project.table_name}.id"
sql<<" WHERE (#{Project.table_name}.id = %s OR #{Project.table_name}.parent_id = %s)"%[@project.id,@project.id]
sql<<" AND (%s)"%Project.allowed_to_condition(User.current,:view_time_entries)
sql<<" AND spent_on BETWEEN '%s' AND '%s'"%[ActiveRecord::Base.connection.quoted_date(@date_from.to_time),ActiveRecord::Base.connection.quoted_date(@date_to.to_time)]
sql<<" GROUP BY #{sql_group_by}, tyear, tmonth, tweek"
@ -80,6 +87,8 @@ class TimelogController < ApplicationController