* 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
This commit is contained in:
1 parent
87742f23ed
commit
c01c64e978
29 files changed
+200
-8
No files matched your search
@@ -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
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ class Issue < ActiveRecord::Base
|
||||
|
||||
has_many :journals, :as => :journalized, :dependent => :destroy
|
||||
has_many :attachments, :as => :container, :dependent => :destroy
|
||||
has_many :time_entries, :dependent => :nullify
|
||||
has_many :time_entries, :dependent => :delete_all
|
||||
has_many :custom_values, :dependent => :delete_all, :as => :customized
|
||||
has_many :custom_fields, :through => :custom_values
|
||||
has_and_belongs_to_many :changesets, :order => "revision ASC"
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
<% form_tag({}) do %>
|
||||
<div class="box">
|
||||
<p><strong><%= l(:text_issue_category_destroy_question, @issue_count) %></strong></p>
|
||||
<p><%= radio_button_tag 'todo', 'nullify', true %> <%= l(:text_issue_category_destroy_assignments) %><br />
|
||||
<p><label><%= radio_button_tag 'todo', 'nullify', true %> <%= l(:text_issue_category_destroy_assignments) %></label><br />
|
||||
<% if @categories.size > 0 %>
|
||||
<%= radio_button_tag 'todo', 'reassign', false %> <%= l(:text_issue_category_reassign_to) %>:
|
||||
<label><%= radio_button_tag 'todo', 'reassign', false %> <%= l(:text_issue_category_reassign_to) %></label>:
|
||||
<%= select_tag 'reassign_to_id', options_from_collection_for_select(@categories, 'id', 'name') %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<h2><%= l(:confirmation) %></h2>
|
||||
|
||||
<% form_tag do %>
|
||||
<%= @issues.collect {|i| hidden_field_tag 'ids[]', i.id } %>
|
||||
<div class="box">
|
||||
<p><strong><%= l(:text_destroy_time_entries_question, @hours) %></strong></p>
|
||||
<p>
|
||||
<label><%= radio_button_tag 'todo', 'destroy', true %> <%= l(:text_destroy_time_entries) %></label><br />
|
||||
<label><%= radio_button_tag 'todo', 'nullify', false %> <%= l(:text_assign_time_entries_to_project) %></label><br />
|
||||
<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").checked=true;' %>
|
||||
</p>
|
||||
</div>
|
||||
<%= submit_tag l(:button_apply) %>
|
||||
<% end %>
|
||||
Reference in new issue
Block a user