summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2023-04-09 01:38:36 +0000
committerGo MAEDA <maeda@farend.jp>2023-04-09 01:38:36 +0000
commit565d13d6540de55d177074ce51c65611cc7737a0 (patch)
treefbffc87679bad4959b5a1583b0db067ee13b37ec
parent544af76dda2810cb752fb343651849629cc81e1d (diff)
downloadredmine-565d13d6540de55d177074ce51c65611cc7737a0.tar.gz
redmine-565d13d6540de55d177074ce51c65611cc7737a0.zip
"Issue's subject" filter for spent time (#27821).
Patch by Go MAEDA. git-svn-id: https://svn.redmine.org/redmine/trunk@22173 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/time_entry_query.rb9
-rw-r--r--test/functional/timelog_controller_test.rb13
2 files changed, 22 insertions, 0 deletions
diff --git a/app/models/time_entry_query.rb b/app/models/time_entry_query.rb
index 4e14e0b40..fab5a3448 100644
--- a/app/models/time_entry_query.rb
+++ b/app/models/time_entry_query.rb
@@ -78,6 +78,11 @@ class TimeEntryQuery < Query
:values => lambda {project.issue_categories.collect{|s| [s.name, s.id.to_s]}}
) if project
add_available_filter(
+ "issue.subject",
+ :type => :text,
+ :name => l("label_attribute_of_issue", :name => l(:field_subject))
+ )
+ add_available_filter(
"user_id",
:type => :list_optional, :values => lambda {author_values}
)
@@ -222,6 +227,10 @@ class TimeEntryQuery < Query
sql_for_field("category_id", operator, value, Issue.table_name, "category_id")
end
+ def sql_for_issue_subject_field(field, operator, value)
+ sql_for_field("subject", operator, value, Issue.table_name, "subject")
+ end
+
def sql_for_project_status_field(field, operator, value, options={})
sql_for_field(field, operator, value, Project.table_name, "status")
end
diff --git a/test/functional/timelog_controller_test.rb b/test/functional/timelog_controller_test.rb
index 5aa5eec7c..2ccbf56f4 100644
--- a/test/functional/timelog_controller_test.rb
+++ b/test/functional/timelog_controller_test.rb
@@ -1258,6 +1258,19 @@ class TimelogControllerTest < Redmine::ControllerTest
assert_equal [entry].map(&:id).map(&:to_s), css_select('input[name="ids[]"]').map {|e| e.attr(:value)}
end
+ def text_index_with_issue_subject_filter
+ get(
+ :index,
+ :params => {
+ :f => ['issue.subject'],
+ :op => {'issue.subject' => '~'},
+ :v => {'issue.subject' => ['"updating a recipe"']}
+ }
+ )
+ assert_response :success
+ assert_equal [3], css_select('input[name="ids[]"]').map {|e| e.attr(:value)}
+ end
+
def test_index_with_project_status_filter
project = Project.find(3)
project.close