diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2022-02-20 18:54:28 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2022-02-20 18:54:28 +0000 |
commit | e81ff170be942b3049fa33fad5f9273229338773 (patch) | |
tree | 6fd73bc76a4a622c9424cc93a37327763caba4f8 | |
parent | 5bc98c7b2e009e5516ebd9350f372eaffcffb959 (diff) | |
download | redmine-e81ff170be942b3049fa33fad5f9273229338773.tar.gz redmine-e81ff170be942b3049fa33fad5f9273229338773.zip |
Merged r21423 to 4.1-stable (#36248).
git-svn-id: http://svn.redmine.org/redmine/branches/4.1-stable@21426 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/time_entry_query.rb | 2 | ||||
-rw-r--r-- | test/functional/queries_controller_test.rb | 24 |
2 files changed, 25 insertions, 1 deletions
diff --git a/app/models/time_entry_query.rb b/app/models/time_entry_query.rb index 6f704ded0..b4d423729 100644 --- a/app/models/time_entry_query.rb +++ b/app/models/time_entry_query.rb @@ -89,7 +89,7 @@ class TimeEntryQuery < Query activities = (project ? project.activities : TimeEntryActivity.shared) add_available_filter( "activity_id", - :type => :list, :values => activities.map {|a| [a.name, a.id.to_s]} + :type => :list, :values => activities.map {|a| [a.name, (a.parent_id || a.id).to_s]} ) add_available_filter( "project.status", diff --git a/test/functional/queries_controller_test.rb b/test/functional/queries_controller_test.rb index 55c46478c..50f3dbdab 100644 --- a/test/functional/queries_controller_test.rb +++ b/test/functional/queries_controller_test.rb @@ -818,4 +818,28 @@ class QueriesControllerTest < Redmine::ControllerTest assert_include ["Dave Lopper", "3", "active"], json assert_include ["Dave2 Lopper2", "5", "locked"], json end + + def test_activity_filter_should_return_active_and_system_activity_ids + TimeEntryActivity.create!(:name => 'Design', :parent_id => 9, :project_id => 1) + TimeEntryActivity.create!(:name => 'QA', :active => false, :parent_id => 11, :project_id => 1) + TimeEntryActivity.create!(:name => 'Inactive Activity', :active => true, :parent_id => 14, :project_id => 1) + + @request.session[:user_id] = 2 + get( + :filter, + :params => { + :project_id => 1, + :type => 'TimeEntryQuery', + :name => 'activity_id' + } + ) + assert_response :success + assert_equal 'application/json', response.media_type + json = ActiveSupport::JSON.decode(response.body) + + assert_equal 3, json.count + assert_include ["Design", "9"], json + assert_include ["Development", "10"], json + assert_include ["Inactive Activity", "14"], json + end end |