diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-03-08 21:22:08 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-03-08 21:22:08 +0000 |
commit | ff6d8c6f5c2eac2cddec200f3c3b5d2c1366d349 (patch) | |
tree | 9ef56acc32c708d2941b94ef5d4ca88e1f830a28 /app | |
parent | 9c6ba6653981b9ae921d1ca115946bc1fc39d3af (diff) | |
download | redmine-ff6d8c6f5c2eac2cddec200f3c3b5d2c1366d349.tar.gz redmine-ff6d8c6f5c2eac2cddec200f3c3b5d2c1366d349.zip |
Adding a subtask should default to a tracker without disabled parent field (#16260).
git-svn-id: http://svn.redmine.org/redmine/trunk@16383 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/models/issue.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index d96f61e15..a8b68ccbb 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -530,10 +530,17 @@ class Issue < ActiveRecord::Base self.tracker_id = t end end - if project + if project && tracker.nil? # Set a default tracker to accept custom field values # even if tracker is not specified - self.tracker ||= allowed_target_trackers(user).first + allowed_trackers = allowed_target_trackers(user) + + if attrs['parent_issue_id'].present? + # If parent_issue_id is present, the first tracker for which this field + # is not disabled is chosen as default + self.tracker = allowed_trackers.detect {|t| t.core_fields.include?('parent_issue_id')} + end + self.tracker ||= allowed_trackers.first end statuses_allowed = new_statuses_allowed_to(user) |