OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/lib/open_project/costs/patches/projects_controller_patch.rb

23 lines
695 B

require_dependency 'projects_controller'
module OpenProject::Costs::Patches::ProjectsControllerPatch
def self.included(base) # :nodoc:
base.send(:include, InstanceMethods)
base.class_eval do
before_filter :own_total_hours, :only => [:show]
end
end
module InstanceMethods
def own_total_hours
if User.current.allowed_to?(:view_own_time_entries, @project)
cond = @project.project_condition(Setting.display_subprojects_work_packages?)
@total_hours = TimeEntry.visible.sum(:hours, :include => :project, :conditions => cond).to_f
end
end
end
end
ProjectsController.send(:include, OpenProject::Costs::Patches::ProjectsControllerPatch)