@@ -55,8 +55,7 class TimelogController < ApplicationController | |||||
55 |
|
55 | |||
56 | sql = "SELECT #{sql_select}, tyear, tmonth, tweek, spent_on, SUM(hours) AS hours" |
|
56 | sql = "SELECT #{sql_select}, tyear, tmonth, tweek, spent_on, SUM(hours) AS hours" | |
57 | sql << " FROM #{TimeEntry.table_name}" |
|
57 | sql << " FROM #{TimeEntry.table_name}" | |
58 | sql << " LEFT JOIN #{Issue.table_name} ON #{TimeEntry.table_name}.issue_id = #{Issue.table_name}.id" |
|
58 | sql << time_report_joins | |
59 | sql << " LEFT JOIN #{Project.table_name} ON #{TimeEntry.table_name}.project_id = #{Project.table_name}.id" |
|
|||
60 | sql << " WHERE" |
|
59 | sql << " WHERE" | |
61 | sql << " (%s) AND" % sql_condition |
|
60 | sql << " (%s) AND" % sql_condition | |
62 | sql << " (spent_on BETWEEN '%s' AND '%s')" % [ActiveRecord::Base.connection.quoted_date(@from), ActiveRecord::Base.connection.quoted_date(@to)] |
|
61 | sql << " (spent_on BETWEEN '%s' AND '%s')" % [ActiveRecord::Base.connection.quoted_date(@from), ActiveRecord::Base.connection.quoted_date(@to)] | |
@@ -314,4 +313,12 private | |||||
314 | call_hook(:controller_timelog_available_criterias, { :available_criterias => @available_criterias, :project => @project }) |
|
313 | call_hook(:controller_timelog_available_criterias, { :available_criterias => @available_criterias, :project => @project }) | |
315 | @available_criterias |
|
314 | @available_criterias | |
316 | end |
|
315 | end | |
|
316 | ||||
|
317 | def time_report_joins | |||
|
318 | sql = '' | |||
|
319 | sql << " LEFT JOIN #{Issue.table_name} ON #{TimeEntry.table_name}.issue_id = #{Issue.table_name}.id" | |||
|
320 | sql << " LEFT JOIN #{Project.table_name} ON #{TimeEntry.table_name}.project_id = #{Project.table_name}.id" | |||
|
321 | call_hook(:controller_timelog_time_report_joins, {:sql => sql} ) | |||
|
322 | sql | |||
|
323 | end | |||
317 | end |
|
324 | end |
General Comments 0
You need to be logged in to leave comments.
Login now