diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-02-29 22:54:07 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-02-29 22:54:07 +0000 |
commit | c01c64e9783dc361d98ca8dc37d2b3a661ae1945 (patch) | |
tree | 42c3c5a2b6e59e5a1879601f37d69d4c651911e3 /app/controllers | |
parent | 87742f23edb3bbcbaf12540d2ff510ad8edac09e (diff) | |
download | redmine-c01c64e9783dc361d98ca8dc37d2b3a661ae1945.tar.gz redmine-c01c64e9783dc361d98ca8dc37d2b3a661ae1945.zip |
Let the user choose when deleting issues with reported hours (closes #734, #71):
* to delete the hours
* to assign the hours to the project
* to reassign the hours to another issue
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1182 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/issues_controller.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index e03afb252..53627db92 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -263,6 +263,26 @@ class IssuesController < ApplicationController end def destroy + @hours = TimeEntry.sum(:hours, :conditions => ['issue_id IN (?)', @issues]).to_f + if @hours > 0 + case params[:todo] + when 'destroy' + # nothing to do + when 'nullify' + TimeEntry.update_all('issue_id = NULL', ['issue_id IN (?)', @issues]) + when 'reassign' + reassign_to = @project.issues.find_by_id(params[:reassign_to_id]) + if reassign_to.nil? + flash.now[:error] = l(:error_issue_not_found_in_project) + return + else + TimeEntry.update_all("issue_id = #{reassign_to.id}", ['issue_id IN (?)', @issues]) + end + else + # display the destroy form + return + end + end @issues.each(&:destroy) redirect_to :action => 'index', :project_id => @project end |