Few fixes and cleaning.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/work@2161 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
1 parent
1773be565c
commit
ea729654cc
1 file changed
+2
-4
@@ -142,7 +142,7 @@ class Project < ActiveRecord::Base
|
|||||||
|
|
||||||
def project_condition(with_subprojects)
|
def project_condition(with_subprojects)
|
||||||
cond = "#{Project.table_name}.id = #{id}"
|
cond = "#{Project.table_name}.id = #{id}"
|
||||||
cond = "(#{cond} OR #{Project.table_name}.parent_id = #{id})" if with_subprojects
|
cond = "(#{cond} OR (#{Project.table_name}.lft > #{lft} AND #{Project.table_name}.rgt < #{rgt}))" if with_subprojects
|
||||||
cond
|
cond
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -229,7 +229,7 @@ class Project < ActiveRecord::Base
|
|||||||
@rolled_up_trackers ||=
|
@rolled_up_trackers ||=
|
||||||
Tracker.find(:all, :include => :projects,
|
Tracker.find(:all, :include => :projects,
|
||||||
:select => "DISTINCT #{Tracker.table_name}.*",
|
:select => "DISTINCT #{Tracker.table_name}.*",
|
||||||
:conditions => ["#{Project.table_name}.id = ? OR #{Project.table_name}.parent_id = ?", id, id],
|
:conditions => ["#{Project.table_name}.lft >= ? AND #{Project.table_name}.rgt <= ?", lft, rgt],
|
||||||
:order => "#{Tracker.table_name}.position")
|
:order => "#{Tracker.table_name}.position")
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -300,8 +300,6 @@ class Project < ActiveRecord::Base
|
|||||||
|
|
||||||
protected
|
protected
|
||||||
def validate
|
def validate
|
||||||
#errors.add(parent_id, " must be a root project") if parent and parent.parent
|
|
||||||
#errors.add_to_base("A project with subprojects can't be a subproject") if parent and children.size > 0
|
|
||||||
errors.add(:identifier, :activerecord_error_invalid) if !identifier.blank? && identifier.match(/^\d*$/)
|
errors.add(:identifier, :activerecord_error_invalid) if !identifier.blank? && identifier.match(/^\d*$/)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user