diff options
author | Go MAEDA <maeda@farend.jp> | 2018-09-14 03:40:37 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2018-09-14 03:40:37 +0000 |
commit | 156b8e2ee638428cfa1387d783237a82c573f9cd (patch) | |
tree | ec943afeb8236b06a695624befaaa3883b9774a0 /app/controllers/timelog_controller.rb | |
parent | f288ccb9871fc4d5271b3d5c40a68f487c5b4ae5 (diff) | |
download | redmine-156b8e2ee638428cfa1387d783237a82c573f9cd.tar.gz redmine-156b8e2ee638428cfa1387d783237a82c573f9cd.zip |
Allow project bulk edit of time entries (#26534).
Patch by Marius BALTEANU.
git-svn-id: http://svn.redmine.org/redmine/trunk@17482 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/timelog_controller.rb')
-rw-r--r-- | app/controllers/timelog_controller.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb index c23e47713..50fcab2f7 100644 --- a/app/controllers/timelog_controller.rb +++ b/app/controllers/timelog_controller.rb @@ -165,8 +165,18 @@ class TimelogController < ApplicationController end def bulk_edit - @available_activities = @projects.map(&:activities).reduce(:&) + @target_projects = Project.allowed_to(:log_time).to_a @custom_fields = TimeEntry.first.available_custom_fields.select {|field| field.format.bulk_edit_supported} + if params[:time_entry] + @target_project = @target_projects.detect {|p| p.id.to_s == params[:time_entry][:project_id].to_s} + end + if @target_project + @available_activities = @target_project.activities + else + @available_activities = @projects.map(&:activities).reduce(:&) + end + @time_entry_params = params[:time_entry] || {} + @time_entry_params[:custom_field_values] ||= {} end def bulk_update |