summaryrefslogtreecommitdiffstats
path: root/app/models/issue.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-14 05:45:16 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-04-14 05:45:16 +0000
commit09375960d69dcca6dafe4b126b77994f523efba8 (patch)
tree263680473e25b24e4e6410d258bf3ac902a137a0 /app/models/issue.rb
parent354e09811b5d044afb6152efa2cdd38bdeac60a4 (diff)
downloadredmine-09375960d69dcca6dafe4b126b77994f523efba8.tar.gz
redmine-09375960d69dcca6dafe4b126b77994f523efba8.zip
When copying issues, let the status be changed to default or left unchanged.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9404 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r--app/models/issue.rb38
1 files changed, 21 insertions, 17 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index ec8c45d34..8ebc20fc0 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -511,24 +511,28 @@ class Issue < ActiveRecord::Base
# Returns an array of statuses that user is able to apply
def new_statuses_allowed_to(user=User.current, include_default=false)
- initial_status = nil
- if new_record?
- initial_status = IssueStatus.default
- elsif status_id_was
- initial_status = IssueStatus.find_by_id(status_id_was)
+ if new_record? && @copied_from
+ [IssueStatus.default, @copied_from.status].compact.uniq.sort
+ else
+ initial_status = nil
+ if new_record?
+ initial_status = IssueStatus.default
+ elsif status_id_was
+ initial_status = IssueStatus.find_by_id(status_id_was)
+ end
+ initial_status ||= status
+
+ statuses = initial_status.find_new_statuses_allowed_to(
+ user.admin ? Role.all : user.roles_for_project(project),
+ tracker,
+ author == user,
+ assigned_to_id_changed? ? assigned_to_id_was == user.id : assigned_to_id == user.id
+ )
+ statuses << initial_status unless statuses.empty?
+ statuses << IssueStatus.default if include_default
+ statuses = statuses.compact.uniq.sort
+ blocked? ? statuses.reject {|s| s.is_closed?} : statuses
end
- initial_status ||= status
-
- statuses = initial_status.find_new_statuses_allowed_to(
- user.admin ? Role.all : user.roles_for_project(project),
- tracker,
- author == user,
- assigned_to_id_changed? ? assigned_to_id_was == user.id : assigned_to_id == user.id
- )
- statuses << initial_status unless statuses.empty?
- statuses << IssueStatus.default if include_default
- statuses = statuses.compact.uniq.sort
- blocked? ? statuses.reject {|s| s.is_closed?} : statuses
end
def assigned_to_was