summaryrefslogtreecommitdiffstats
path: root/app/models/issue_query.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-05-06 18:59:36 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-05-06 18:59:36 +0000
commit699a75910db7e7e4caafaee19808a8a80d9acceb (patch)
tree973755cce7a6c567292024b4e6d1f7bf146423f0 /app/models/issue_query.rb
parent860ae0631ad5514a08db6ac980c1b0ff3bbb170a (diff)
downloadredmine-699a75910db7e7e4caafaee19808a8a80d9acceb.tar.gz
redmine-699a75910db7e7e4caafaee19808a8a80d9acceb.zip
Filter by issue id (#4806).
A shortcut is added to the context menu to filter the selected issues. git-svn-id: http://svn.redmine.org/redmine/trunk@15371 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue_query.rb')
-rw-r--r--app/models/issue_query.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/issue_query.rb b/app/models/issue_query.rb
index c97de0a19..c4ab37d59 100644
--- a/app/models/issue_query.rb
+++ b/app/models/issue_query.rb
@@ -245,6 +245,8 @@ class IssueQuery < Query
add_available_filter "parent_id", :type => :tree, :label => :field_parent_issue
add_available_filter "child_id", :type => :tree, :label => :label_subtask_plural
+ add_available_filter "issue_id", :type => :integer, :label => :label_issue
+
Tracker.disabled_core_fields(trackers).each {|field|
delete_available_filter field
}
@@ -509,6 +511,15 @@ class IssueQuery < Query
end
end
+ def sql_for_issue_id_field(field, operator, value)
+ ids = value.first.to_s.scan(/\d+/).map(&:to_i).join(",")
+ if ids.present?
+ "#{Issue.table_name}.id IN (#{ids})"
+ else
+ "1=0"
+ end
+ end
+
def sql_for_relations(field, operator, value, options={})
relation_options = IssueRelation::TYPES[field]
return relation_options unless relation_options