patch
s@spserv:~/sites/redmine/trunk$ svn diff
Index: app/models/query.rb
===================================================================
--- app/models/query.rb (revision 7841)
+++ app/models/query.rb (working copy)
@@ -222,6 +222,7 @@
"start_date" => { :type => :date, :order => 11 },
"due_date" => { :type => :date, :order => 12 },
"estimated_hours" => { :type => :float, :order => 13 },
+ "related_to" => { :type => :list, :order => 15, :values => [["blocked by any open issue", "blocked by any open issue"]]},
"done_ratio" => { :type => :integer, :order => 14 }}
principals = []
@@ -591,6 +592,29 @@
sql_for_field(field, '=', value, db_table, 'user_id') + ')'
end
+ def sql_for_related_to_field(field, operator, value)
+ if operator == '='
+ cond = 'IN'
+ else
+ cond = 'NOT IN'
+ end
+
+ relation_table = IssueRelation.table_name
+ issue_table = Issue.table_name
+ link_type = 'blocks'
+
+ statuses_table = IssueStatus.table_name
+ closed_issue_statuses = "SELECT id from #{statuses_table} WHERE is_closed=1"
+
+ # all CLOSED issues have blocked links
+ linked_sql = "SELECT #{relation_table}.issue_to_id from #{relation_table}, #{issue_table} WHERE "
+ linked_sql << "relation_type='#{link_type}' AND "
+ linked_sql << "#{issue_table}.id = #{relation_table}.issue_from_id AND "
+ linked_sql << "#{issue_table}.status_id NOT IN (#{closed_issue_statuses})"
+
+ "#{issue_table}.id #{cond} (#{linked_sql})"
+ end
+
def sql_for_member_of_group_field(field, operator, value)
if operator == '*' # Any group
groups = Group.all
Index: config/locales/en.yml
===================================================================
--- config/locales/en.yml (revision 7841)
+++ config/locales/en.yml (working copy)
@@ -314,6 +314,7 @@
field_scm_path_encoding: Path encoding
field_path_to_repository: Path to repository
field_root_directory: Root directory
+ field_related_to: Related
field_cvsroot: CVSROOT
field_cvs_module: Module