When a specific TimeEntryActivity are change, associated TimeEntries will be
re-assigned to the correct record. * Renamed build to create since the methods now create objects. * Removed call to Project#save that isn't needed since objects are saved directly now. * Wrapped the activity creation and updates in a SQL transaction so TimeEntries will remain in a consistent state if there is an error. * When a Project's TimeEntryActivities are destroyed, they are now reassigned to the parent TimeEntryActivity. #4077 git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2950 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -234,10 +234,11 @@ class ProjectsController < ApplicationController
|
||||
|
||||
def save_activities
|
||||
if request.post? && params[:enumerations]
|
||||
params[:enumerations].each do |id, activity|
|
||||
@project.update_or_build_time_entry_activity(id, activity)
|
||||
Project.transaction do
|
||||
params[:enumerations].each do |id, activity|
|
||||
@project.update_or_create_time_entry_activity(id, activity)
|
||||
end
|
||||
end
|
||||
@project.save
|
||||
end
|
||||
|
||||
redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project
|
||||
@@ -245,7 +246,7 @@ class ProjectsController < ApplicationController
|
||||
|
||||
def reset_activities
|
||||
@project.time_entry_activities.each do |time_entry_activity|
|
||||
time_entry_activity.destroy
|
||||
time_entry_activity.destroy(time_entry_activity.parent)
|
||||
end
|
||||
redirect_to :controller => 'projects', :action => 'settings', :tab => 'activities', :id => @project
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user