Actions
Defect #8239
closednotes field is not propagated during issue copy
Start date:
2011-04-27
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Affected version:
Description
scenario (vanilla installation of redmine):
- open existing issue
- click copy
- add notes
- click copy button
notes are not visible, they are lost
Files
Related issues
Updated by Etienne Massip over 13 years ago
- Target version set to Candidate for next minor release
Confirmed with demo site, I'll try to investigate further.
Updated by Etienne Massip over 13 years ago
Had a quick look yesterday evening, Issue#new.copy_from
does not copy current journal.
Maybe that call to Issue#init_journal
in IssueMovesController
should be moved to model after call to #copy_from
and only for a move action (do we really need a journal entry in a copy context if no notes are filled in) ?
Updated by Etienne Massip over 13 years ago
This change prevents double #save
:
Index: app/models/issue.rb
===================================================================
--- app/models/issue.rb (revision 5543)
+++ app/models/issue.rb (working copy)
@@ -147,10 +147,18 @@
end || false
end
- def move_to_project_without_transaction(new_project, new_tracker = nil, options = {})
+ def move_to_project_without_transaction(new_project, notes = nil, new_tracker = nil, options = {})
options ||= {}
- issue = options[:copy] ? self.class.new.copy_from(self) : self
-
+
+ if options[:copy]
+ issue = self.class.new.copy_from(self)
+ issue.instance_variable_set :@current_journal, Journal.new(:journalized => issue, :user => User.current, :notes => notes) if notes.present?
+ else
+ issue = self
+ issue.init_journal(User.current)
+ issue.current_journal.notes = notes if notes.present?
+ end
+
if new_project && issue.project_id != new_project.id
# delete issue relations
unless Setting.cross_project_issue_relations?
@@ -867,7 +875,8 @@
:prop_key => c,
:old_value => @issue_before_change.send(c),
:value => send(c)) unless send(c)==@issue_before_change.send(c)
- }
+ } if @issue_before_change
+
# custom fields changes
custom_values.each {|c|
next if (@custom_values_before_change[c.custom_field_id]==c.value ||
@@ -876,7 +885,8 @@
:prop_key => c.custom_field_id,
:old_value => @custom_values_before_change[c.custom_field_id],
:value => c.value)
- }
+ } if @custom_values_before_change
+
@current_journal.save
# reset current journal
init_journal @current_journal.user, @current_journal.notes
Index: app/controllers/issue_moves_controller.rb
===================================================================
--- app/controllers/issue_moves_controller.rb (revision 5543)
+++ app/controllers/issue_moves_controller.rb (working copy)
@@ -17,10 +17,8 @@
moved_issues = []
@issues.each do |issue|
issue.reload
- issue.init_journal(User.current)
- issue.current_journal.notes = @notes if @notes.present?
call_hook(:controller_issues_move_before_save, { :params => params, :issue => issue, :target_project => @target_project, :copy => !!@copy })
- if r = issue.move_to_project(@target_project, new_tracker, {:copy => @copy, :attributes => extract_changed_attributes_for_move(params)})
+ if r = issue.move_to_project(@target_project, @notes, new_tracker, {:copy => @copy, :attributes => extract_changed_attributes_for_move(params)})
moved_issues << r
else
unsaved_issue_ids << issue.id
Updated by Etienne Massip over 13 years ago
- Assignee deleted (
johann sebatian) - Target version changed from Candidate for next minor release to 1.2.0
Updated by Etienne Massip over 13 years ago
- File issue_copy.patch issue_copy.patch added
Less intrusive based on trunk ?
Updated by Jean-Philippe Lang over 13 years ago
- Status changed from New to Closed
- Resolution set to Fixed
This was fixed in r5602. Anything wrong with it?
Actions