diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-10-02 10:21:02 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-10-02 10:21:02 +0000 |
commit | 87e36462d61ac14330b3a49ac1c6d49e577970a0 (patch) | |
tree | 4a81e6e631ed78bf9c98bfad42ee079e5f17aa1e /app/models | |
parent | 98327ab4a4e071f7260ff7d951d9c2d48bf16b1e (diff) | |
download | redmine-87e36462d61ac14330b3a49ac1c6d49e577970a0.tar.gz redmine-87e36462d61ac14330b3a49ac1c6d49e577970a0.zip |
Merged r15855 (#23766).
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@15875 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/issue.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index d2e36e8fd..3f963a08a 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -496,8 +496,13 @@ class Issue < ActiveRecord::Base # Project and Tracker must be set before since new_statuses_allowed_to depends on it. if (p = attrs.delete('project_id')) && safe_attribute?('project_id') - if allowed_target_projects(user).where(:id => p.to_i).exists? - self.project_id = p + if p.is_a?(String) && !p.match(/^\d*$/) + p_id = Project.find_by_identifier(p).try(:id) + else + p_id = p.to_i + end + if allowed_target_projects(user).where(:id => p_id).exists? + self.project_id = p_id end if project_id_changed? && attrs['category_id'].to_s == category_id_was.to_s |