##// END OF EJS Templates
Merged r13055 (#16519)....
Jean-Philippe Lang -
r12918:438cd4d6fa42
parent child
Show More
@@ -137,7 +137,7 module Redmine
137 custom_fields += TimeEntryActivityCustomField.all
137 custom_fields += TimeEntryActivityCustomField.all
138
138
139 # Add list and boolean custom fields as available criteria
139 # Add list and boolean custom fields as available criteria
140 custom_fields.select {|cf| %w(list bool).include? cf.field_format }.each do |cf|
140 custom_fields.select {|cf| %w(list bool).include?(cf.field_format) && !cf.multiple?}.each do |cf|
141 @available_criteria["cf_#{cf.id}"] = {:sql => cf.group_statement,
141 @available_criteria["cf_#{cf.id}"] = {:sql => cf.group_statement,
142 :joins => cf.join_for_order_statement,
142 :joins => cf.join_for_order_statement,
143 :format => cf.field_format,
143 :format => cf.field_format,
@@ -99,7 +99,7 class TimeEntryReportsControllerTest < ActionController::TestCase
99 assert_equal "162.90", "%.2f" % assigns(:report).total_hours
99 assert_equal "162.90", "%.2f" % assigns(:report).total_hours
100 end
100 end
101
101
102 def test_report_custom_field_criteria_with_multiple_values
102 def test_report_custom_field_criteria_with_multiple_values_on_single_value_custom_field_should_not_fail
103 field = TimeEntryCustomField.create!(:name => 'multi', :field_format => 'list', :possible_values => ['value1', 'value2'])
103 field = TimeEntryCustomField.create!(:name => 'multi', :field_format => 'list', :possible_values => ['value1', 'value2'])
104 entry = TimeEntry.create!(:project => Project.find(1), :hours => 1, :activity_id => 10, :user => User.find(2), :spent_on => Date.today)
104 entry = TimeEntry.create!(:project => Project.find(1), :hours => 1, :activity_id => 10, :user => User.find(2), :spent_on => Date.today)
105 CustomValue.create!(:customized => entry, :custom_field => field, :value => 'value1')
105 CustomValue.create!(:customized => entry, :custom_field => field, :value => 'value1')
@@ -109,6 +109,18 class TimeEntryReportsControllerTest < ActionController::TestCase
109 assert_response :success
109 assert_response :success
110 end
110 end
111
111
112 def test_report_multiple_values_custom_fields_should_not_be_proposed
113 TimeEntryCustomField.create!(:name => 'Single', :field_format => 'list', :possible_values => ['value1', 'value2'])
114 TimeEntryCustomField.create!(:name => 'Multi', :field_format => 'list', :multiple => true, :possible_values => ['value1', 'value2'])
115
116 get :report, :project_id => 1
117 assert_response :success
118 assert_select 'select[name=?]', 'criteria[]' do
119 assert_select 'option', :text => 'Single'
120 assert_select 'option', :text => 'Multi', :count => 0
121 end
122 end
123
112 def test_report_one_day
124 def test_report_one_day
113 get :report, :project_id => 1, :columns => 'day', :from => "2007-03-23", :to => "2007-03-23", :criteria => ["user", "activity"]
125 get :report, :project_id => 1, :columns => 'day', :from => "2007-03-23", :to => "2007-03-23", :criteria => ["user", "activity"]
114 assert_response :success
126 assert_response :success
General Comments 0
You need to be logged in to leave comments. Login now