@@ -225,8 +225,11 class TimelogController < ApplicationController | |||
|
225 | 225 | def destroy |
|
226 | 226 | (render_404; return) unless @time_entry |
|
227 | 227 | (render_403; return) unless @time_entry.editable_by?(User.current) |
|
228 | @time_entry.destroy | |
|
229 | flash[:notice] = l(:notice_successful_delete) | |
|
228 | if @time_entry.destroy && @time_entry.destroyed? | |
|
229 | flash[:notice] = l(:notice_successful_delete) | |
|
230 | else | |
|
231 | flash[:error] = l(:notice_unable_delete_time_entry) | |
|
232 | end | |
|
230 | 233 | redirect_to :back |
|
231 | 234 | rescue ::ActionController::RedirectBackError |
|
232 | 235 | redirect_to :action => 'details', :project_id => @time_entry.project |
@@ -175,6 +175,7 de: | |||
|
175 | 175 | notice_account_pending: "Ihr Konto wurde erstellt und wartet jetzt auf die Genehmigung des Administrators." |
|
176 | 176 | notice_default_data_loaded: Die Standard-Konfiguration wurde erfolgreich geladen. |
|
177 | 177 | notice_unable_delete_version: Die Version konnte nicht gelöscht werden. |
|
178 | notice_unable_delete_time_entry: Der Zeiterfassungseintrag konnte nicht gelöscht werden. | |
|
178 | 179 | notice_issue_done_ratios_updated: Der Ticket-Fortschritt wurde aktualisiert. |
|
179 | 180 | |
|
180 | 181 | error_can_t_load_default_data: "Die Standard-Konfiguration konnte nicht geladen werden: {{value}}" |
@@ -153,6 +153,7 en: | |||
|
153 | 153 | notice_account_pending: "Your account was created and is now pending administrator approval." |
|
154 | 154 | notice_default_data_loaded: Default configuration successfully loaded. |
|
155 | 155 | notice_unable_delete_version: Unable to delete version. |
|
156 | notice_unable_delete_time_entry: Unable to delete time log entry. | |
|
156 | 157 | notice_issue_done_ratios_updated: Issue done ratios updated. |
|
157 | 158 | |
|
158 | 159 | error_can_t_load_default_data: "Default configuration could not be loaded: {{value}}" |
@@ -116,9 +116,27 class TimelogControllerTest < ActionController::TestCase | |||
|
116 | 116 | @request.session[:user_id] = 2 |
|
117 | 117 | post :destroy, :id => 1 |
|
118 | 118 | assert_redirected_to :action => 'details', :project_id => 'ecookbook' |
|
119 | assert_equal I18n.t(:notice_successful_delete), flash[:notice] | |
|
119 | 120 | assert_nil TimeEntry.find_by_id(1) |
|
120 | 121 | end |
|
121 | 122 | |
|
123 | def test_destroy_should_fail | |
|
124 | # simulate that this fails (e.g. due to a plugin), see #5700 | |
|
125 | TimeEntry.class_eval do | |
|
126 | before_destroy :stop_callback_chain | |
|
127 | def stop_callback_chain ; return false ; end | |
|
128 | end | |
|
129 | ||
|
130 | @request.session[:user_id] = 2 | |
|
131 | post :destroy, :id => 1 | |
|
132 | assert_redirected_to :action => 'details', :project_id => 'ecookbook' | |
|
133 | assert_equal I18n.t(:notice_unable_delete_time_entry), flash[:error] | |
|
134 | assert_not_nil TimeEntry.find_by_id(1) | |
|
135 | ||
|
136 | # remove the simulation | |
|
137 | TimeEntry.before_destroy.reject! {|callback| callback.method == :stop_callback_chain } | |
|
138 | end | |
|
139 | ||
|
122 | 140 | def test_report_no_criteria |
|
123 | 141 | get :report, :project_id => 1 |
|
124 | 142 | assert_response :success |
General Comments 0
You need to be logged in to leave comments.
Login now