Adds members of subprojects in assignee and author filters (#10126).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8747 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang committed 2012-02-01 20:07:01 +00:00
1 parent 0154d7477b
commit 2808adf99f
4 files changed
+38 -7

No files matched your search

+10
View File
@@ -33,6 +33,16 @@ class Principal < ActiveRecord::Base
}
}
# Principals that are members of a collection of projects
named_scope :member_of, lambda {|projects|
if projects.empty?
{:conditions => "1=0"}
else
ids = projects.map(&:id)
{:conditions => ["#{Principal.table_name}.status = 1 AND #{Principal.table_name}.id IN (SELECT DISTINCT user_id FROM #{Member.table_name} WHERE project_id IN (?))", ids]}
end
}
before_create :set_default_empty_values
def name(formatter = nil)