Patch #3052 ยป redmine-issue-inspire_on.patch
| app/controllers/issues_controller.rb | ||
|---|---|---|
| 139 | 139 |
|
| 140 | 140 |
if request.get? || request.xhr? |
| 141 | 141 |
@issue.start_date ||= Date.today |
| 142 |
@issue.inspire_on(params[:inspire_on]) if params[:inspire_on] |
|
| 142 | 143 |
else |
| 143 | 144 |
requested_status = IssueStatus.find_by_id(params[:issue][:status_id]) |
| 144 | 145 |
# Check that the user is allowed to apply the requested status |
| ... | ... | |
| 147 | 148 |
attach_files(@issue, params[:attachments]) |
| 148 | 149 |
flash[:notice] = l(:notice_successful_create) |
| 149 | 150 |
Mailer.deliver_issue_add(@issue) if Setting.notified_events.include?('issue_added')
|
| 150 |
redirect_to(params[:continue] ? { :action => 'new', :tracker_id => @issue.tracker } :
|
|
| 151 |
redirect_to(params[:continue] ? { :action => 'new', :tracker_id => @issue.tracker,
|
|
| 152 |
:inspire_on => @issue.id } : |
|
| 151 | 153 |
{ :action => 'show', :id => @issue })
|
| 152 | 154 |
return |
| 153 | 155 |
end |
| app/models/issue.rb | ||
|---|---|---|
| 69 | 69 |
self.custom_values = issue.custom_values.collect {|v| v.clone}
|
| 70 | 70 |
self |
| 71 | 71 |
end |
| 72 | ||
| 73 |
def inspire_on(arg) |
|
| 74 |
issue = arg.is_a?(Issue) ? arg : Issue.find(arg) |
|
| 75 |
self.attributes = issue.attributes.dup.slice!("category_id",
|
|
| 76 |
"status_id", |
|
| 77 |
"assigned_to_id", |
|
| 78 |
"priority_id", |
|
| 79 |
"fixed_version_id") |
|
| 80 |
self.custom_values = issue.custom_values.collect {|v| v.clone}
|
|
| 81 |
self.watcher_user_ids = issue.watcher_user_ids.clone |
|
| 82 |
self |
|
| 83 |
end |
|
| 72 | 84 |
|
| 73 | 85 |
# Move an issue to a new project and tracker |
| 74 | 86 |
def move_to(new_project, new_tracker = nil) |