From 3d4d6c31f3b225b2c588cde559730515c2e246ff Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 12 Apr 2016 16:55:30 +0000 Subject: Merged r15318 and r15319 (#22342). git-svn-id: http://svn.redmine.org/redmine/branches/3.2-stable@15329 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/issue.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'app') diff --git a/app/models/issue.rb b/app/models/issue.rb index cf657d63a..ae3dd103a 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -302,16 +302,17 @@ 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 - if status == default_status + tracker_was = self.tracker + association(:tracker).writer(tracker) + if tracker != tracker_was + if status == tracker_was.try(:default_status) self.status = nil elsif status && tracker && !tracker.issue_status_ids.include?(status.id) self.status = nil end - @custom_field_values = nil + reassign_custom_field_values @workflow_rule_by_attribute = nil end - association(:tracker).writer(tracker) self.status ||= default_status self.tracker end @@ -355,7 +356,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 -- cgit v1.2.3