diff options
author | Eric Davis <edavis@littlestreamsoftware.com> | 2010-06-20 19:30:51 +0000 |
---|---|---|
committer | Eric Davis <edavis@littlestreamsoftware.com> | 2010-06-20 19:30:51 +0000 |
commit | c98f46d691542baf769bc74e25f808277cd5878b (patch) | |
tree | 782da4af3ea854db9db637358650d5cea7517f34 /app/controllers/timelog_controller.rb | |
parent | acef1d535225123bdd93083eeaa3bfb03b74b26e (diff) | |
download | redmine-c98f46d691542baf769bc74e25f808277cd5878b.tar.gz redmine-c98f46d691542baf769bc74e25f808277cd5878b.zip |
Handle unsuccessful destroys in TimelogController. #5700
Contributed by Jan
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3805 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/timelog_controller.rb')
-rw-r--r-- | app/controllers/timelog_controller.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/app/controllers/timelog_controller.rb b/app/controllers/timelog_controller.rb index 160c19974..73ff58b82 100644 --- a/app/controllers/timelog_controller.rb +++ b/app/controllers/timelog_controller.rb @@ -225,8 +225,11 @@ class TimelogController < ApplicationController def destroy (render_404; return) unless @time_entry (render_403; return) unless @time_entry.editable_by?(User.current) - @time_entry.destroy - flash[:notice] = l(:notice_successful_delete) + if @time_entry.destroy && @time_entry.destroyed? + flash[:notice] = l(:notice_successful_delete) + else + flash[:error] = l(:notice_unable_delete_time_entry) + end redirect_to :back rescue ::ActionController::RedirectBackError redirect_to :action => 'details', :project_id => @time_entry.project |