104 |
104 |
sql << " WHERE (%s)" % Project.allowed_to_condition(User.current, :view_issues)
|
105 |
105 |
unless @project.nil?
|
106 |
106 |
sql << " AND (project_id = #{@project.id}"
|
107 |
|
sql << " OR project_id IN (%s)" % @project.descendants.active.visible.collect { |p| p.id }.join(',') unless @project.descendants.active.visible.empty?
|
|
107 |
sql << " OR project_id IN (%s)" % @project.active_children.collect { |p| p.id }.join(',') unless @project.active_children.empty?
|
108 |
108 |
sql << " )"
|
109 |
109 |
end
|
110 |
110 |
sql << " GROUP BY project_id"
|
... | ... | |
262 |
262 |
find_optional_project
|
263 |
263 |
if !@project.nil?
|
264 |
264 |
ids = [@project.id]
|
265 |
|
ids += @project.descendants.active.visible.collect(&:id)
|
266 |
|
@issues = Issue.visible.find(:first, :conditions => ["#{Project.table_name}.id IN (?)", ids])
|
|
265 |
ids += @project.active_children.collect(&:id)
|
|
266 |
@issues = Issue.find(:first)
|
267 |
267 |
else
|
268 |
|
@issues = Issue.visible.find(:first)
|
|
268 |
@issues = Issue.find(:first)
|
269 |
269 |
end
|
270 |
270 |
rescue ActiveRecord::RecordNotFound
|
271 |
271 |
render_404
|
... | ... | |
275 |
275 |
find_optional_project
|
276 |
276 |
if !@project.nil?
|
277 |
277 |
ids = [@project.id]
|
278 |
|
ids += @project.descendants.active.visible.collect(&:id)
|
279 |
|
@issues = Issue.visible.find(:all, :include => [:status], :conditions => ["#{IssueStatus.table_name}.is_closed=? AND #{Project.table_name}.id IN (?)", false, ids])
|
|
278 |
ids += @project.active_children.collect(&:id)
|
|
279 |
@issues = Issue.find(:all, :include => [:status], :conditions => ["#{IssueStatus.table_name}.is_closed=?", false])
|
280 |
280 |
else
|
281 |
|
@issues = Issue.visible.find(:all, :include => [:status], :conditions => ["#{IssueStatus.table_name}.is_closed=?", false])
|
|
281 |
@issues = Issue.find(:all, :include => [:status], :conditions => ["#{IssueStatus.table_name}.is_closed=?", false])
|
282 |
282 |
end
|
283 |
283 |
rescue ActiveRecord::RecordNotFound
|
284 |
284 |
render_404
|