summaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-10-28 14:31:59 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-10-28 14:31:59 +0000
commit0af6f347580dd7c331f16aa50904d010fad19e23 (patch)
tree62abc086a5c11385d04901dba5c0b050a2346034 /app/models
parentbb4acc02d06d507424057ea41eebe54fdb224b85 (diff)
downloadredmine-0af6f347580dd7c331f16aa50904d010fad19e23.tar.gz
redmine-0af6f347580dd7c331f16aa50904d010fad19e23.zip
Added the hability to copy an issue.
It can be done from the 'issue/show' view or from the context menu on the issue list. The Copy functionality is of course only available if the user is allowed to create an issue. It copies the issue attributes and the custom fields values. git-svn-id: http://redmine.rubyforge.org/svn/trunk@873 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models')
-rw-r--r--app/models/issue.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 972bf0135..0d2d6fc0d 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -54,6 +54,13 @@ class Issue < ActiveRecord::Base
end
end
+ def copy_from(arg)
+ issue = arg.is_a?(Issue) ? arg : Issue.find(arg)
+ self.attributes = issue.attributes.dup
+ self.custom_values = issue.custom_values.collect {|v| v.clone}
+ self
+ end
+
def priority_id=(pid)
self.priority = nil
write_attribute(:priority_id, pid)