@@ -264,15 +264,9 class IssuesController < ApplicationController | |||||
264 | moved_issues = [] |
|
264 | moved_issues = [] | |
265 | @issues.each do |issue| |
|
265 | @issues.each do |issue| | |
266 | issue.reload |
|
266 | issue.reload | |
267 | changed_attributes = {} |
|
|||
268 | [:assigned_to_id, :status_id, :start_date, :due_date].each do |valid_attribute| |
|
|||
269 | unless params[valid_attribute].blank? |
|
|||
270 | changed_attributes[valid_attribute] = (params[valid_attribute] == 'none' ? nil : params[valid_attribute]) |
|
|||
271 | end |
|
|||
272 | end |
|
|||
273 | issue.init_journal(User.current) |
|
267 | issue.init_journal(User.current) | |
274 | call_hook(:controller_issues_move_before_save, { :params => params, :issue => issue, :target_project => @target_project, :copy => !!@copy }) |
|
268 | call_hook(:controller_issues_move_before_save, { :params => params, :issue => issue, :target_project => @target_project, :copy => !!@copy }) | |
275 | if r = issue.move_to_project(@target_project, new_tracker, {:copy => @copy, :attributes => changed_attributes}) |
|
269 | if r = issue.move_to_project(@target_project, new_tracker, {:copy => @copy, :attributes => extract_changed_attributes_for_move(params)}) | |
276 | moved_issues << r |
|
270 | moved_issues << r | |
277 | else |
|
271 | else | |
278 | unsaved_issue_ids << issue.id |
|
272 | unsaved_issue_ids << issue.id | |
@@ -485,4 +479,14 private | |||||
485 | return false |
|
479 | return false | |
486 | end |
|
480 | end | |
487 | end |
|
481 | end | |
|
482 | ||||
|
483 | def extract_changed_attributes_for_move(params) | |||
|
484 | changed_attributes = {} | |||
|
485 | [:assigned_to_id, :status_id, :start_date, :due_date].each do |valid_attribute| | |||
|
486 | unless params[valid_attribute].blank? | |||
|
487 | changed_attributes[valid_attribute] = (params[valid_attribute] == 'none' ? nil : params[valid_attribute]) | |||
|
488 | end | |||
|
489 | end | |||
|
490 | changed_attributes | |||
|
491 | end | |||
488 | end |
|
492 | end |
General Comments 0
You need to be logged in to leave comments.
Login now