summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-04-11 17:11:59 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-04-11 17:11:59 +0000
commitbb2c6f607610442d6be8de893ff15ff715ceb0d7 (patch)
treedf597e2f977e01a667940205d1285bf601c303e8 /app/models
parentbf60f4def06c57b636af97b45772bd41f1c5cd8c (diff)
downloadredmine-bb2c6f607610442d6be8de893ff15ff715ceb0d7.tar.gz
redmine-bb2c6f607610442d6be8de893ff15ff715ceb0d7.zip
Fixed that subtasks lose their custom fields when copying an issue to a different project (#22342).
git-svn-id: http://svn.redmine.org/redmine/trunk@15318 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/issue.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 5bf845d84..b433da30b 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -302,16 +302,19 @@ class Issue < ActiveRecord::Base
# * or if the status was not part of the new tracker statuses
# * or the status was nil
def tracker=(tracker)
- if tracker != self.tracker
+ tracker_was = self.tracker
+ if tracker != tracker_was
if status == default_status
self.status = nil
elsif status && tracker && !tracker.issue_status_ids.include?(status.id)
self.status = nil
end
- @custom_field_values = nil
@workflow_rule_by_attribute = nil
end
association(:tracker).writer(tracker)
+ if tracker != tracker_was
+ reassign_custom_field_values
+ end
self.status ||= default_status
self.tracker
end
@@ -355,7 +358,7 @@ class Issue < ActiveRecord::Base
unless valid_parent_project?
self.parent_issue_id = nil
end
- @custom_field_values = nil
+ reassign_custom_field_values
@workflow_rule_by_attribute = nil
end
# Set fixed_version to the project default version if it's valid