diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-12-20 09:05:31 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-12-20 09:05:31 +0000 |
commit | 0453c56b221fb9afd07ceacbd58502999a2dec07 (patch) | |
tree | 502609a304ac809c70941e259b91b0bf9364ea29 /app/models | |
parent | e2b3fcabded6cd24173168140c484def03aefe7d (diff) | |
download | redmine-0453c56b221fb9afd07ceacbd58502999a2dec07.tar.gz redmine-0453c56b221fb9afd07ceacbd58502999a2dec07.zip |
Merged r16071 (#24595).
git-svn-id: http://svn.redmine.org/redmine/branches/3.2-stable@16100 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/project.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index ee24056ed..b2fa1893d 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -350,6 +350,10 @@ class Project < ActiveRecord::Base self.status == STATUS_ACTIVE end + def closed? + self.status == STATUS_CLOSED + end + def archived? self.status == STATUS_ARCHIVED end @@ -377,8 +381,12 @@ class Project < ActiveRecord::Base # Unarchives the project # All its ancestors must be active def unarchive - return false if ancestors.detect {|a| !a.active?} - update_attribute :status, STATUS_ACTIVE + return false if ancestors.detect {|a| a.archived?} + new_status = STATUS_ACTIVE + if parent + new_status = parent.status + end + update_attribute :status, new_status end def close |