Adds a link to automatically close completed versions in project settings (#1245).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3023 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
1 parent
cc684803ba
commit
8f40750ad7
7 files changed
+61
-4
No files matched your search
@@ -304,6 +304,17 @@ class Project < ActiveRecord::Base
|
||||
:order => "#{Tracker.table_name}.position")
|
||||
end
|
||||
|
||||
# Closes open and locked project versions that are completed
|
||||
def close_completed_versions
|
||||
Version.transaction do
|
||||
versions.find(:all, :conditions => {:status => %w(open locked)}).each do |version|
|
||||
if version.completed?
|
||||
version.update_attribute(:status, 'closed')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Returns a hash of project users grouped by role
|
||||
def users_by_role
|
||||
members.find(:all, :include => [:user, :roles]).inject({}) do |h, m|
|
||||
|
||||
Reference in new issue
Block a user