1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-31 11:37:14 +00:00

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
This commit is contained in:
Jean-Philippe Lang 2016-11-18 08:21:11 +00:00
parent 88ab6dd946
commit 3c067ba8bd

View File

@ -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