From 3c067ba8bd72273a1de36795b66221e2f094e185 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 18 Nov 2016 08:21:11 +0000 Subject: [PATCH] Bulk edit for shows activities not available for the time entry's project (#23922). git-svn-id: http://svn.redmine.org/redmine/trunk@15953 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/timelog_controller.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb index 9ae7a7252..4256ff30e 100644 --- a/app/controllers/timelog_controller.rb +++ b/app/controllers/timelog_controller.rb @@ -168,7 +168,7 @@ class TimelogController < ApplicationController end def bulk_edit - @available_activities = TimeEntryActivity.shared.active + @available_activities = @projects.map(&:activities).reduce(:&) @custom_fields = TimeEntry.first.available_custom_fields.select {|field| field.format.bulk_edit_supported} end @@ -231,7 +231,10 @@ private end def find_time_entries - @time_entries = TimeEntry.where(:id => params[:id] || params[:ids]).preload(:project, :user).to_a + @time_entries = TimeEntry.where(:id => params[:id] || params[:ids]). + preload(:project => :time_entry_activities). + preload(:user).to_a + raise ActiveRecord::RecordNotFound if @time_entries.empty? raise Unauthorized unless @time_entries.all? {|t| t.editable_by?(User.current)} @projects = @time_entries.collect(&:project).compact.uniq -- 2.39.5