Patch #29162 » 0001-Only-allow-the-use-of-visible-custom-fields-in-time-.patch
lib/redmine/helpers/time_report.rb | ||
---|---|---|
129 | 129 |
} |
130 | 130 | |
131 | 131 |
# Add time entry custom fields |
132 |
custom_fields = TimeEntryCustomField.all
|
|
132 |
custom_fields = TimeEntryCustomField.visible
|
|
133 | 133 |
# Add project custom fields |
134 |
custom_fields += ProjectCustomField.all
|
|
134 |
custom_fields += ProjectCustomField.visible
|
|
135 | 135 |
# Add issue custom fields |
136 |
custom_fields += (@project.nil? ? IssueCustomField.for_all : @project.all_issue_custom_fields)
|
|
136 |
custom_fields += @project.nil? ? IssueCustomField.visible.for_all : @project.all_issue_custom_fields.visible
|
|
137 | 137 |
# Add time entry activity custom fields |
138 |
custom_fields += TimeEntryActivityCustomField.all
|
|
138 |
custom_fields += TimeEntryActivityCustomField.visible
|
|
139 | 139 | |
140 | 140 |
# Add list and boolean custom fields as available criteria |
141 | 141 |
custom_fields.select {|cf| %w(list bool).include?(cf.field_format) && !cf.multiple?}.each do |cf| |
test/functional/timelog_report_test.rb | ||
---|---|---|
135 | 135 |
end |
136 | 136 |
end |
137 | 137 | |
138 |
def test_hidden_custom_fields_should_not_be_proposed |
|
139 |
TimeEntryCustomField.create!(name: 'shown', field_format: 'list', possible_values: ['value1', 'value2'], visible: true) |
|
140 |
TimeEntryCustomField.create!(name: 'Hidden', field_format: 'list', possible_values: ['value1', 'value2'], visible: false) |
|
141 | ||
142 |
get :report, :params => {:project_id => 1} |
|
143 |
assert_response :success |
|
144 |
assert_select 'select[name=?]', 'criteria[]' do |
|
145 |
assert_select 'option', :text => 'Shown' |
|
146 |
assert_select 'option', :text => 'Hidden', :count => 0 |
|
147 |
end |
|
148 |
end |
|
149 | ||
138 | 150 |
def test_report_one_day |
139 | 151 |
get :report, :params => {:project_id => 1, :columns => 'day', :from => "2007-03-23", :to => "2007-03-23", :criteria => ["user", "activity"]} |
140 | 152 |
assert_response :success |