Fixed that displaying time entries with custom field column raises an error (#5037).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12041 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
4069f95fd1
commit
dc5e5eca6b
|
@ -76,6 +76,10 @@ class CustomField < ActiveRecord::Base
|
|||
|
||||
CUSTOM_FIELDS_NAMES = CUSTOM_FIELDS_TABS.collect{|v| v[:name]}
|
||||
|
||||
def visible_by?(project, user=User.current)
|
||||
visible? || user.admin?
|
||||
end
|
||||
|
||||
def field_format=(arg)
|
||||
# cannot change format of a saved custom field
|
||||
super if new_record?
|
||||
|
|
|
@ -25,7 +25,7 @@ class IssueCustomField < CustomField
|
|||
end
|
||||
|
||||
def visible_by?(project, user=User.current)
|
||||
visible? || user.admin? || (roles & user.roles_for_project(project)).present?
|
||||
super || (roles & user.roles_for_project(project)).present?
|
||||
end
|
||||
|
||||
def validate_custom_field
|
||||
|
|
|
@ -548,6 +548,17 @@ class TimelogControllerTest < ActionController::TestCase
|
|||
assert_select 'td.issue_cf_2', :text => 'filter_on_issue_custom_field'
|
||||
end
|
||||
|
||||
def test_index_with_time_entry_custom_field_column
|
||||
field = TimeEntryCustomField.generate!(:field_format => 'string')
|
||||
entry = TimeEntry.generate!(:hours => 2.5, :custom_field_values => {field.id => 'CF Value'})
|
||||
field_name = "cf_#{field.id}"
|
||||
|
||||
get :index, :c => ["hours", field_name]
|
||||
assert_response :success
|
||||
assert_include field_name.to_sym, assigns(:query).column_names
|
||||
assert_select "td.#{field_name}", :text => 'CF Value'
|
||||
end
|
||||
|
||||
def test_index_atom_feed
|
||||
get :index, :project_id => 1, :format => 'atom'
|
||||
assert_response :success
|
||||
|
|
Loading…
Reference in New Issue