Merge branch 'release/5.0' into dev

pull/6827/head
Oliver Günther 9 years ago
commit bebc33dfee
  1. 12
      app/models/cost_query/filter/user_id.rb
  2. 2
      lib/open_project/reporting/engine.rb

@ -23,10 +23,16 @@ class CostQuery::Filter::UserId < Report::Filter::Base
end
def self.available_values(*)
users = Project.visible.collect(&:users).flatten.uniq.sort
# All users which are members in projects the user can see.
# Excludes the anonymous user
users = User.joins(members: :project)
.merge(Project.visible)
.where.not(id: User.anonymous)
.order_by_name
.select(User::USER_FORMATS_STRUCTURE[Setting.user_format].map(&:to_s) << :id)
.distinct
values = users.map { |u| [u.name, u.id] }
values.delete_if { |u| (u.first.include? 'OpenProject Admin') || (u.first.include? 'Anonymous') }
values.sort!
values.unshift ["<< #{::I18n.t(:label_me)} >>", User.current.id.to_s] if User.current.logged?
values
end

@ -63,7 +63,7 @@ module OpenProject::Reporting
after: :time_entries,
caption: :cost_reports_title,
if: Proc.new { |project| project.module_enabled?(:reporting_module) },
html: { class: 'icon2 icon-stats' }
html: { class: 'icon2 icon-cost-reports' }
# Cost reports should remove the default time entries menu item
hide_menu_item :project_menu,

Loading…
Cancel
Save