From 0af6f347580dd7c331f16aa50904d010fad19e23 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 28 Oct 2007 14:31:59 +0000 Subject: 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 --- app/models/issue.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/models') 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) -- cgit v1.2.3