comparison app/models/issue_query.rb @ 1517:dffacf8a6908 redmine-2.5

Update to Redmine SVN revision 13367 on 2.5-stable branch
author Chris Cannam
date Tue, 09 Sep 2014 09:29:00 +0100
parents e248c7af89ec
children
comparison
equal deleted inserted replaced
1516:b450a9d58aed 1517:dffacf8a6908
140 issue_custom_fields = project.all_issue_custom_fields 140 issue_custom_fields = project.all_issue_custom_fields
141 else 141 else
142 if all_projects.any? 142 if all_projects.any?
143 principals += Principal.member_of(all_projects) 143 principals += Principal.member_of(all_projects)
144 end 144 end
145 versions = Version.visible.find_all_by_sharing('system') 145 versions = Version.visible.where(:sharing => 'system').all
146 issue_custom_fields = IssueCustomField.where(:is_for_all => true) 146 issue_custom_fields = IssueCustomField.where(:is_for_all => true)
147 end 147 end
148 principals.uniq! 148 principals.uniq!
149 principals.sort! 149 principals.sort!
150 users = principals.select {|p| p.is_a?(User)} 150 users = principals.select {|p| p.is_a?(User)}
151 151
152 add_available_filter "status_id", 152 add_available_filter "status_id",
153 :type => :list_status, :values => IssueStatus.sorted.all.collect{|s| [s.name, s.id.to_s] } 153 :type => :list_status, :values => IssueStatus.sorted.collect{|s| [s.name, s.id.to_s] }
154 154
155 if project.nil? 155 if project.nil?
156 project_values = [] 156 project_values = []
157 if User.current.logged? && User.current.memberships.any? 157 if User.current.logged? && User.current.memberships.any?
158 project_values << ["<< #{l(:label_my_projects).downcase} >>", "mine"] 158 project_values << ["<< #{l(:label_my_projects).downcase} >>", "mine"]
331 order(order_option). 331 order(order_option).
332 joins(joins_for_order_statement(order_option.join(','))). 332 joins(joins_for_order_statement(order_option.join(','))).
333 limit(options[:limit]). 333 limit(options[:limit]).
334 offset(options[:offset]) 334 offset(options[:offset])
335 335
336 if has_custom_field_column? 336 scope = scope.preload(:custom_values)
337 scope = scope.preload(:custom_values) 337 if has_column?(:author)
338 scope = scope.preload(:author)
338 end 339 end
339 340
340 issues = scope.all 341 issues = scope.all
341 342
342 if has_column?(:spent_hours) 343 if has_column?(:spent_hours)
407 operator = '=' # Override the operator since we want to find by assigned_to 408 operator = '=' # Override the operator since we want to find by assigned_to
408 elsif operator == "!*" 409 elsif operator == "!*"
409 groups = Group.all 410 groups = Group.all
410 operator = '!' # Override the operator since we want to find by assigned_to 411 operator = '!' # Override the operator since we want to find by assigned_to
411 else 412 else
412 groups = Group.find_all_by_id(value) 413 groups = Group.where(:id => value).all
413 end 414 end
414 groups ||= [] 415 groups ||= []
415 416
416 members_of_groups = groups.inject([]) {|user_ids, group| 417 members_of_groups = groups.inject([]) {|user_ids, group|
417 user_ids + group.user_ids + [group.id] 418 user_ids + group.user_ids + [group.id]