summaryrefslogtreecommitdiffstats
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-04-02 17:12:02 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-04-02 17:12:02 +0000
commit0a82489ddcc2f2603c11741f5b653e898170d9fd (patch)
tree4e7df3bf27444cf25088d62f6b2a81e9c0b359d1 /app/models/project.rb
parent006b8716ed0c746f644dd1cf145c1b31d21e4097 (diff)
downloadredmine-0a82489ddcc2f2603c11741f5b653e898170d9fd.tar.gz
redmine-0a82489ddcc2f2603c11741f5b653e898170d9fd.zip
Added the ability to include subprojects issues on calendar & gantt (options box)
git-svn-id: http://redmine.rubyforge.org/svn/trunk@398 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index fe02cd829..2419e720d 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -47,6 +47,19 @@ class Project < ActiveRecord::Base
errors[:identifier].nil? && !(new_record? || identifier.blank?)
end
+ def issues_with_subprojects(include_subprojects=false)
+ conditions = nil
+ if include_subprojects && children.size > 0
+ ids = [id] + children.collect {|c| c.id}
+ conditions = ["#{Issue.table_name}.project_id IN (#{ids.join(',')})"]
+ else
+ conditions = ["#{Issue.table_name}.project_id = ?", id]
+ end
+ Issue.with_scope :find => { :conditions => conditions } do
+ yield
+ end
+ end
+
# returns latest created projects
# non public projects will be returned only if user is a member of those
def self.latest(user=nil, count=5)