summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-05-13 19:52:37 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-05-13 19:52:37 +0000
commitece5232110d0ac148f45b9bac1badf1547ef6c87 (patch)
tree15567985182c5fa69001dce48f46096e8343e46f /app/models
parent7e41730293c5df1dd393495f4c8fe4124da82ff8 (diff)
downloadredmine-ece5232110d0ac148f45b9bac1badf1547ef6c87.tar.gz
redmine-ece5232110d0ac148f45b9bac1badf1547ef6c87.zip
Fixed that values of custom fields are not kept in issues when copying a project (#13910).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11843 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/project.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index 127362ff1..915644c6b 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -848,6 +848,9 @@ class Project < ActiveRecord::Base
new_issue = Issue.new
new_issue.copy_from(issue, :subtasks => false, :link => false)
new_issue.project = self
+ # Changing project resets the custom field values
+ # TODO: handle this in Issue#project=
+ new_issue.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h}
# Reassign fixed_versions by name, since names are unique per project
if issue.fixed_version && issue.fixed_version.project == project
new_issue.fixed_version = self.versions.detect {|v| v.name == issue.fixed_version.name}