]> source.dussan.org Git - redmine.git/commitdiff
Adds boolean and list custom fields for time entries as criteria on timelog report.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 22 Jul 2008 19:06:13 +0000 (19:06 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 22 Jul 2008 19:06:13 +0000 (19:06 +0000)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1691 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/timelog_controller.rb

index 9f539d459921d5b37edf6fc0541ee34e4610694f..605e7e61e4af4bc31abe241f7616d6899ebe5963 100644 (file)
@@ -60,6 +60,13 @@ class TimelogController < ApplicationController
                                              :label => cf.name}
     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 = @criterias.select{|criteria| @available_criterias.has_key? criteria}
     @criterias.uniq!