##// END OF EJS Templates
Merged r15848 (#23764)....
Jean-Philippe Lang -
r15490:ec06e55eb1d6
parent child
Show More
@@ -226,7 +226,7 class Issue < ActiveRecord::Base
226 # Copies attributes from another issue, arg can be an id or an Issue
226 # Copies attributes from another issue, arg can be an id or an Issue
227 def copy_from(arg, options={})
227 def copy_from(arg, options={})
228 issue = arg.is_a?(Issue) ? arg : Issue.visible.find(arg)
228 issue = arg.is_a?(Issue) ? arg : Issue.visible.find(arg)
229 self.attributes = issue.attributes.dup.except("id", "root_id", "parent_id", "lft", "rgt", "created_on", "updated_on")
229 self.attributes = issue.attributes.dup.except("id", "root_id", "parent_id", "lft", "rgt", "created_on", "updated_on", "closed_on")
230 self.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h}
230 self.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h}
231 self.status = issue.status
231 self.status = issue.status
232 self.author = User.current
232 self.author = User.current
@@ -1220,6 +1220,16 class IssueTest < ActiveSupport::TestCase
1220 end
1220 end
1221 end
1221 end
1222
1222
1223 def test_copy_should_clear_closed_on
1224 copied_open = Issue.find(8).copy(:status_id => 1)
1225 assert copied_open.save
1226 assert_nil copied_open.closed_on
1227
1228 copied_closed = Issue.find(8).copy
1229 assert copied_closed.save
1230 assert_not_nil copied_closed.closed_on
1231 end
1232
1223 def test_should_not_call_after_project_change_on_creation
1233 def test_should_not_call_after_project_change_on_creation
1224 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
1234 issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1,
1225 :subject => 'Test', :author_id => 1)
1235 :subject => 'Test', :author_id => 1)
General Comments 0
You need to be logged in to leave comments. Login now