@@ -379,15 +379,17 class Project < ActiveRecord::Base | |||||
379 |
|
379 | |||
380 | # Returns a scope of the Versions used by the project |
|
380 | # Returns a scope of the Versions used by the project | |
381 | def shared_versions |
|
381 | def shared_versions | |
382 | @shared_versions ||= |
|
382 | @shared_versions ||= begin | |
|
383 | r = root? ? self : root | |||
383 | Version.scoped(:include => :project, |
|
384 | Version.scoped(:include => :project, | |
384 | :conditions => "#{Project.table_name}.id = #{id}" + |
|
385 | :conditions => "#{Project.table_name}.id = #{id}" + | |
385 | " OR (#{Project.table_name}.status = #{Project::STATUS_ACTIVE} AND (" + |
|
386 | " OR (#{Project.table_name}.status = #{Project::STATUS_ACTIVE} AND (" + | |
386 | " #{Version.table_name}.sharing = 'system'" + |
|
387 | " #{Version.table_name}.sharing = 'system'" + | |
387 |
" OR (#{Project.table_name}.lft >= #{r |
|
388 | " OR (#{Project.table_name}.lft >= #{r.lft} AND #{Project.table_name}.rgt <= #{r.rgt} AND #{Version.table_name}.sharing = 'tree')" + | |
388 | " OR (#{Project.table_name}.lft < #{lft} AND #{Project.table_name}.rgt > #{rgt} AND #{Version.table_name}.sharing IN ('hierarchy', 'descendants'))" + |
|
389 | " OR (#{Project.table_name}.lft < #{lft} AND #{Project.table_name}.rgt > #{rgt} AND #{Version.table_name}.sharing IN ('hierarchy', 'descendants'))" + | |
389 | " OR (#{Project.table_name}.lft > #{lft} AND #{Project.table_name}.rgt < #{rgt} AND #{Version.table_name}.sharing = 'hierarchy')" + |
|
390 | " OR (#{Project.table_name}.lft > #{lft} AND #{Project.table_name}.rgt < #{rgt} AND #{Version.table_name}.sharing = 'hierarchy')" + | |
390 | "))") |
|
391 | "))") | |
|
392 | end | |||
391 | end |
|
393 | end | |
392 |
|
394 | |||
393 | # Returns a hash of project users grouped by role |
|
395 | # Returns a hash of project users grouped by role |
General Comments 0
You need to be logged in to leave comments.
Login now