summaryrefslogtreecommitdiffstats
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-01-16 21:27:48 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-01-16 21:27:48 +0000
commit049051103b02efdef64f4119959d95d23d45e392 (patch)
treecfb967b5c44fdbdb2e5fc5aa328a058128238379 /app/models/project.rb
parent18066ba8bf68da4b00b7e740e6c67f8d8b1e0093 (diff)
downloadredmine-049051103b02efdef64f4119959d95d23d45e392.tar.gz
redmine-049051103b02efdef64f4119959d95d23d45e392.zip
On the calendar, the gantt and in the Tracker filter on the issue list, only active trackers of the project (and its sub projects) can be selected.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1071 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 60a7a84a4..0e7f8284c 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -146,6 +146,15 @@ class Project < ActiveRecord::Base
children.select {|child| child.active?}
end
+ # Returns an array of the trackers used by the project and its sub projects
+ def rolled_up_trackers
+ @rolled_up_trackers ||=
+ Tracker.find(:all, :include => :projects,
+ :select => "DISTINCT #{Tracker.table_name}.*",
+ :conditions => ["#{Project.table_name}.id = ? OR #{Project.table_name}.parent_id = ?", id, id],
+ :order => "#{Tracker.table_name}.position")
+ end
+
# Deletes all project's members
def delete_all_members
Member.delete_all(['project_id = ?', id])