summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-10-02 10:19:20 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-10-02 10:19:20 +0000
commitec06e55eb1d6800bc91a50c1d17e8b841039db1f (patch)
treebe5343cfa62a680284f76fd4c4af0dd07fd87588
parentae4bfd53345168453bdb7fa60193b40760abcb1b (diff)
downloadredmine-ec06e55eb1d6800bc91a50c1d17e8b841039db1f.tar.gz
redmine-ec06e55eb1d6800bc91a50c1d17e8b841039db1f.zip
Merged r15848 (#23764).
git-svn-id: http://svn.redmine.org/redmine/branches/3.1-stable@15872 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/models/issue.rb2
-rw-r--r--test/unit/issue_test.rb12
2 files changed, 12 insertions, 2 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index d374bd3b1..60102f208 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -226,7 +226,7 @@ class Issue < ActiveRecord::Base
# Copies attributes from another issue, arg can be an id or an Issue
def copy_from(arg, options={})
issue = arg.is_a?(Issue) ? arg : Issue.visible.find(arg)
- self.attributes = issue.attributes.dup.except("id", "root_id", "parent_id", "lft", "rgt", "created_on", "updated_on")
+ self.attributes = issue.attributes.dup.except("id", "root_id", "parent_id", "lft", "rgt", "created_on", "updated_on", "closed_on")
self.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h}
self.status = issue.status
self.author = User.current
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index 36327d828..cde6fc815 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -673,7 +673,7 @@ class IssueTest < ActiveSupport::TestCase
user = User.find(2)
group = Group.generate!
group.users << user
-
+
issue = Issue.generate!(:author_id => 1, :assigned_to => group)
assert_include 4, issue.new_statuses_allowed_to(user).map(&:id)
end
@@ -1220,6 +1220,16 @@ class IssueTest < ActiveSupport::TestCase
end
end
+ def test_copy_should_clear_closed_on
+ copied_open = Issue.find(8).copy(:status_id => 1)
+ assert copied_open.save
+ assert_nil copied_open.closed_on
+
+ copied_closed = Issue.find(8).copy
+ assert copied_closed.save
+ assert_not_nil copied_closed.closed_on
+ end
+
def test_should_not_call_after_project_change_on_creation
issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
:subject => 'Test', :author_id => 1)