diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-07-27 19:36:53 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-07-27 19:36:53 +0000 |
commit | 9eb041fbc7999af55c13aa93d2c2df027f8faf73 (patch) | |
tree | 4987b0520ed5f5be67bab56fb3f194498d2fbfb3 /app/models/issue.rb | |
parent | ed165f671620409c39830a7d8326d37c27ea2fc1 (diff) | |
download | redmine-9eb041fbc7999af55c13aa93d2c2df027f8faf73.tar.gz redmine-9eb041fbc7999af55c13aa93d2c2df027f8faf73.zip |
Versions that are not shared should not be assignable when selecting another project (#11506).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10086 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r-- | app/models/issue.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index a06378a5b..e4de32b53 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -148,6 +148,7 @@ class Issue < ActiveRecord::Base def reload(*args) @workflow_rule_by_attribute = nil + @assignable_versions = nil super end @@ -252,6 +253,8 @@ class Issue < ActiveRecord::Base write_attribute(:project_id, project ? project.id : nil) association_instance_set('project', project) if project_was && project && project_was != project + @assignable_versions = nil + unless keep_tracker || project.trackers.include?(tracker) self.tracker = project.trackers.first end @@ -639,7 +642,21 @@ class Issue < ActiveRecord::Base # Versions that the issue can be assigned to def assignable_versions - @assignable_versions ||= (project.shared_versions.open + [Version.find_by_id(fixed_version_id_was)]).compact.uniq.sort + return @assignable_versions if @assignable_versions + + versions = project.shared_versions.open.all + if fixed_version + if fixed_version_id_changed? + # nothing to do + elsif project_id_changed? + if project.shared_versions.include?(fixed_version) + versions << fixed_version + end + else + versions << fixed_version + end + end + @assignable_versions = versions.uniq.sort end # Returns true if this issue is blocked by another issue that is still open |