Actually block issues from closing when a blocking issue isn't closed (#1740).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2800 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2009-07-04 12:07:03 +00:00
parent 85f634481e
commit 6994d1c23b
4 changed files with 73 additions and 3 deletions
+7 -1
View File
@@ -203,11 +203,17 @@ class Issue < ActiveRecord::Base
project.assignable_users
end
# Returns true if this issue is blocked by another issue that is still open
def blocked?
!relations_to.detect {|ir| ir.relation_type == 'blocks' && !ir.issue_from.closed?}.nil?
end
# Returns an array of status that user is able to apply
def new_statuses_allowed_to(user)
statuses = status.find_new_statuses_allowed_to(user.roles_for_project(project), tracker)
statuses << status unless statuses.empty?
statuses.uniq.sort
statuses = statuses.uniq.sort
blocked? ? statuses.reject {|s| s.is_closed?} : statuses
end
# Returns the mail adresses of users that should be notified for the issue