diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index cba8e59..af53ec2 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -139,6 +139,7 @@ class IssuesController < ApplicationController if request.get? || request.xhr? @issue.start_date ||= Date.today + @issue.inspire_on(params[:inspire_on]) if params[:inspire_on] else requested_status = IssueStatus.find_by_id(params[:issue][:status_id]) # Check that the user is allowed to apply the requested status @@ -147,7 +148,8 @@ class IssuesController < ApplicationController attach_files(@issue, params[:attachments]) flash[:notice] = l(:notice_successful_create) Mailer.deliver_issue_add(@issue) if Setting.notified_events.include?('issue_added') - redirect_to(params[:continue] ? { :action => 'new', :tracker_id => @issue.tracker } : + redirect_to(params[:continue] ? { :action => 'new', :tracker_id => @issue.tracker, + :inspire_on => @issue.id } : { :action => 'show', :id => @issue }) return end diff --git a/app/models/issue.rb b/app/models/issue.rb index e3a9e17..d88ec5a 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -69,6 +69,18 @@ class Issue < ActiveRecord::Base self.custom_values = issue.custom_values.collect {|v| v.clone} self end + + def inspire_on(arg) + issue = arg.is_a?(Issue) ? arg : Issue.find(arg) + self.attributes = issue.attributes.dup.slice!("category_id", + "status_id", + "assigned_to_id", + "priority_id", + "fixed_version_id") + self.custom_values = issue.custom_values.collect {|v| v.clone} + self.watcher_user_ids = issue.watcher_user_ids.clone + self + end # Move an issue to a new project and tracker def move_to(new_project, new_tracker = nil)