Each version of a project can be shared with: * subprojects * projects in the project hierarchy: ancestors + descendants (needs versions management permission on the root project) * projects in the project tree: root project + all its descendants (same as above) * all projects (can be set by admin users only) Notes: * when sharing a version of a private project with others projects, its name will be visible within the other projects * a project with versions used by non descendant projects can not be archived git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3123 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
1 parent
e178123569
commit
5f8e9d7118
40 files changed
+659
-75
No files matched your search
+22
-2
@@ -100,7 +100,10 @@ class Issue < ActiveRecord::Base
|
||||
# reassign to the category with same name if any
|
||||
new_category = issue.category.nil? ? nil : new_project.issue_categories.find_by_name(issue.category.name)
|
||||
issue.category = new_category
|
||||
issue.fixed_version = nil
|
||||
# Keep the fixed_version if it's still valid in the new_project
|
||||
unless new_project.shared_versions.include?(issue.fixed_version)
|
||||
issue.fixed_version = nil
|
||||
end
|
||||
issue.project = new_project
|
||||
end
|
||||
if new_tracker
|
||||
@@ -242,7 +245,7 @@ class Issue < ActiveRecord::Base
|
||||
|
||||
# Versions that the issue can be assigned to
|
||||
def assignable_versions
|
||||
@assignable_versions ||= (project.versions.open + [Version.find_by_id(fixed_version_id_was)]).compact.uniq.sort
|
||||
@assignable_versions ||= (project.shared_versions.open + [Version.find_by_id(fixed_version_id_was)]).compact.uniq.sort
|
||||
end
|
||||
|
||||
# Returns true if this issue is blocked by another issue that is still open
|
||||
@@ -336,6 +339,23 @@ class Issue < ActiveRecord::Base
|
||||
s << ' assigned-to-me' if User.current.logged? && assigned_to_id == User.current.id
|
||||
s
|
||||
end
|
||||
|
||||
# Update all issues so their versions are not pointing to a
|
||||
# fixed_version that is outside of the issue's project hierarchy.
|
||||
#
|
||||
# OPTIMIZE: does a full table scan of Issues with a fixed_version.
|
||||
def self.update_fixed_versions_from_project_hierarchy_change
|
||||
Issue.all(:conditions => ['fixed_version_id IS NOT NULL'],
|
||||
:include => [:project, :fixed_version]
|
||||
).each do |issue|
|
||||
next if issue.project.nil? || issue.fixed_version.nil?
|
||||
unless issue.project.shared_versions.include?(issue.fixed_version)
|
||||
issue.init_journal(User.current)
|
||||
issue.fixed_version = nil
|
||||
issue.save
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
||||
Reference in new issue
Block a user