Adds boolean and list custom fields for time entries as criteria on timelog report.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1691 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2008-07-22 19:06:13 +00:00
parent f54c2d812d
commit d84d38983a
1 changed files with 7 additions and 0 deletions

View File

@ -60,6 +60,13 @@ class TimelogController < ApplicationController
:label => cf.name} :label => cf.name}
end end
# Add list and boolean time entry custom fields
TimeEntryCustomField.find(:all).select {|cf| %w(list bool).include? cf.field_format }.each do |cf|
@available_criterias["cf_#{cf.id}"] = {:sql => "(SELECT c.value FROM custom_values c WHERE c.custom_field_id = #{cf.id} AND c.customized_type = 'TimeEntry' AND c.customized_id = time_entries.id)",
:format => cf.field_format,
:label => cf.name}
end
@criterias = params[:criterias] || [] @criterias = params[:criterias] || []
@criterias = @criterias.select{|criteria| @available_criterias.has_key? criteria} @criterias = @criterias.select{|criteria| @available_criterias.has_key? criteria}
@criterias.uniq! @criterias.uniq!