Просмотр исходного кода

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
tags/3.4.0
Jean-Philippe Lang 7 лет назад
Родитель
Сommit
3c067ba8bd
1 измененных файлов: 5 добавлений и 2 удалений
  1. 5
    2
      app/controllers/timelog_controller.rb

+ 5
- 2
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

Загрузка…
Отмена
Сохранить