summaryrefslogtreecommitdiffstats
path: root/app/controllers
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-11-18 08:21:11 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-11-18 08:21:11 +0000
commit3c067ba8bd72273a1de36795b66221e2f094e185 (patch)
tree002a211cbe6562a2277a9b02e9f46390b71d9164 /app/controllers
parent88ab6dd946f07bca094de24491bc3c151d591d4d (diff)
downloadredmine-3c067ba8bd72273a1de36795b66221e2f094e185.tar.gz
redmine-3c067ba8bd72273a1de36795b66221e2f094e185.zip
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
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/timelog_controller.rb7
1 files 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