summaryrefslogtreecommitdiffstats
path: root/app/models/issue.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-20 18:22:43 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-20 18:22:43 +0000
commitfbf30eec7c58786d615852bc17ffe5a1c49229b6 (patch)
treeff3e3183f87dcb2f18ea02e33b3a154501c5b980 /app/models/issue.rb
parent8a3623733fa2ef879bb2a3f4355e0ce0df49b278 (diff)
downloadredmine-fbf30eec7c58786d615852bc17ffe5a1c49229b6.tar.gz
redmine-fbf30eec7c58786d615852bc17ffe5a1c49229b6.zip
Adds an option of the copy form to enable/disable attachments copy (#3055).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8677 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r--app/models/issue.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb
index 16257bf83..ad91ab488 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -129,14 +129,16 @@ class Issue < ActiveRecord::Base
end
# Copies attributes from another issue, arg can be an id or an Issue
- def copy_from(arg)
+ 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.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
- self.attachments = issue.attachments.map do |attachement|
- attachement.copy(:container => self)
+ unless options[:attachments] == false
+ self.attachments = issue.attachments.map do |attachement|
+ attachement.copy(:container => self)
+ end
end
@copied_from = issue
self