summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/issues_controller.rb5
-rw-r--r--app/views/issues/destroy.html.erb2
2 files changed, 7 insertions, 0 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index 23d3992f1..e1a3d860c 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -367,7 +367,12 @@ class IssuesController < ApplicationController
when 'destroy'
# nothing to do
when 'nullify'
+ if Setting.timelog_required_fields.include?('issue_id')
+ flash.now[:error] = l(:field_issue) + " " + ::I18n.t('activerecord.errors.messages.blank')
+ return
+ else
time_entries.update_all(:issue_id => nil)
+ end
when 'reassign'
reassign_to = @project && @project.issues.find_by_id(params[:reassign_to_id])
if reassign_to.nil?
diff --git a/app/views/issues/destroy.html.erb b/app/views/issues/destroy.html.erb
index 9b08c3698..61b841a62 100644
--- a/app/views/issues/destroy.html.erb
+++ b/app/views/issues/destroy.html.erb
@@ -6,7 +6,9 @@
<p><strong><%= l(:text_destroy_time_entries_question, :hours => number_with_precision(@hours, :precision => 2)) %></strong></p>
<p>
<label><%= radio_button_tag 'todo', 'destroy', true %> <%= l(:text_destroy_time_entries) %></label><br />
+<% unless Setting.timelog_required_fields.include?('issue_id') %>
<label><%= radio_button_tag 'todo', 'nullify', false %> <%= l(:text_assign_time_entries_to_project) %></label><br />
+<% end %>
<% if @project %>
<label><%= radio_button_tag 'todo', 'reassign', false, :onchange => 'if (this.checked) { $("#reassign_to_id").focus(); }' %> <%= l(:text_reassign_time_entries) %></label>
<%= text_field_tag 'reassign_to_id', params[:reassign_to_id], :size => 6, :onfocus => '$("#todo_reassign").attr("checked", true);' %>