Commit cf5dd9d6 authored by jplang's avatar jplang

Column Project is no longer added by default to the list of default columns...

Column Project is no longer added by default to the list of default columns for time entries (#26537).

Patch by Marius BALTEANU.

git-svn-id: https://svn.redmine.org/redmine/trunk@17503 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent f9a9fc5b
......@@ -283,6 +283,6 @@ private
end
def retrieve_time_entry_query
retrieve_query(TimeEntryQuery, false, :defaults => Setting.time_entry_list_defaults.symbolize_keys)
retrieve_query(TimeEntryQuery, false, :defaults => @default_columns_names)
end
end
......@@ -103,14 +103,13 @@ class TimeEntryQuery < Query
def default_columns_names
@default_columns_names ||= begin
default_columns = [:spent_on, :user, :activity, :issue, :comments, :hours]
default_columns = Setting.time_entry_list_defaults.symbolize_keys[:column_names].map(&:to_sym)
project.present? ? default_columns : [:project] | default_columns
end
end
def default_totalable_names
[:hours]
Setting.time_entry_list_defaults.symbolize_keys[:totalable_names].map(&:to_sym)
end
def default_sort_criteria
......
......@@ -13,9 +13,9 @@
<legend><%= l(:setting_time_entry_list_defaults) %></legend>
<% query = TimeEntryQuery.new(Setting.time_entry_list_defaults) %>
<%= hidden_field_tag('settings[time_entry_list_defaults][column_names][]', '') %>
<%= render_query_columns_selection(query,
:name => 'settings[time_entry_list_defaults][column_names]') %>
<p>
<label><%= l(:label_total_plural) %></label>
<%= available_totalable_columns_tags(query,
......
......@@ -219,6 +219,8 @@ time_entry_list_defaults:
- issue
- comments
- hours
totalable_names:
- hours
issue_done_ratio:
default: 'issue_field'
default_projects_public:
......
......@@ -24,7 +24,7 @@ class TimelogControllerTest < Redmine::ControllerTest
:trackers, :enumerations, :issue_statuses,
:custom_fields, :custom_values,
:projects_trackers, :custom_fields_trackers,
:custom_fields_projects
:custom_fields_projects, :issue_categories
include Redmine::I18n
......@@ -744,29 +744,31 @@ class TimelogControllerTest < Redmine::ControllerTest
assert_select '.total-for-hours', :text => 'Hours: 162.90'
assert_select 'form#query_form[action=?]', '/time_entries'
assert_equal ['Date', 'User', 'Activity', 'Issue', 'Comment', 'Hours'], columns_in_list
assert_equal ['Project', 'Date', 'User', 'Activity', 'Issue', 'Comment', 'Hours'], columns_in_list
assert_select '.query-totals>span', 1
end
def test_index_with_default_query_setting
with_settings :time_entry_list_defaults => {'column_names' => %w(spent_on issue user hours)} do
with_settings :time_entry_list_defaults => {'column_names' => %w(spent_on issue user hours), 'totalable_names' => []} do
get :index
assert_response :success
end
assert_select 'table.time-entries thead' do
assert_select 'th.project'
assert_select 'th.spent_on'
assert_select 'th.issue'
assert_select 'th.user'
assert_select 'th.hours'
end
assert_select 'table.time-entries tbody' do
assert_select 'td.project'
assert_select 'td.spent_on'
assert_select 'td.issue'
assert_select 'td.user'
assert_select 'td.hours'
end
assert_equal ['Date', 'Issue', 'User', 'Hours'], columns_in_list
assert_equal ['Project', 'Date', 'Issue', 'User', 'Hours'], columns_in_list
end
def test_index_with_default_query_setting_using_custom_field
......@@ -780,7 +782,7 @@ class TimelogControllerTest < Redmine::ControllerTest
assert_response :success
end
assert_equal ['Date', 'User', 'Hours', 'Foo'], columns_in_list
assert_equal ['Project', 'Date', 'User', 'Hours', 'Foo'], columns_in_list
assert_select '.total-for-hours'
assert_select ".total-for-cf-#{field.id}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment