Index: app/models/journal.rb
===================================================================
--- app/models/journal.rb	(revision 6631)
+++ app/models/journal.rb	(working copy)
@@ -85,4 +85,17 @@
   def notify=(arg)
     @notify = arg
   end
+  
+  # copies a set of journal notes  from one object to another
+  def self.copy_notes(objToId, objFromId)
+   transaction do
+      connection.insert "INSERT INTO #{Journal.table_name} (journalized_id,journalized_type,user_id,notes,created_on)" +
+                              " SELECT #{objToId}, journalized_type,user_id,notes,created_on" +
+                              " FROM #{Journal.table_name}" +
+                              " WHERE journalized_id = #{objFromId}"
+       
+     
+    end
+    true
+  end
 end


Index: app/models/issue.rb
===================================================================
--- app/models/issue.rb	(revision 6631)
+++ app/models/issue.rb	(working copy)
@@ -136,9 +136,28 @@
     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
   end
-
+  # copies attachments from one issue to another
+  def copy_attachment(arg)
+   
+    issue = arg.is_a?(Issue) ? arg : Issue.visible.find(arg)
+    
+    if issue.attachments.any?
+      Attachment.copy_files(id,issue.id)
+    end
+   
+  end
+  
+  def copy_notes(arg)
+    issue = arg.is_a?(Issue) ? arg : Issue.visible.find(arg)
+    
+    if issue.journals.present?
+      Journal.copy_notes(id,issue.id)
+    end
+    
+  end
   # Moves/copies an issue to a new project and tracker
   # Returns the moved/copied issue on success, false on failure
   def move_to_project(*args)
Index: app/models/attachment.rb
===================================================================
--- app/models/attachment.rb	(revision 6631)
+++ app/models/attachment.rb	(working copy)
@@ -160,6 +160,17 @@
     end
     {:files => attached, :unsaved => obj.unsaved_attachments}
   end
+  
+  # copies a set of files attached from one object to another
+  def self.copy_files(objToId, objFromId)
+   transaction do
+       connection.insert "INSERT INTO #{Attachment.table_name} (container_id,container_type,filename,disk_filename,filesize,content_type,digest,downloads,author_id,created_on,description)" +
+                              " SELECT #{objToId}, container_type,filename,disk_filename,filesize,content_type,digest,downloads,author_id,created_on,description" +
+                              " FROM #{Attachment.table_name}" +
+                              " WHERE container_id = #{objFromId}"
+    end
+    true
+  end
 
 private
   def sanitize_filename(value)
Index: app/controllers/issues_controller.rb
===================================================================
--- app/controllers/issues_controller.rb	(revision 6631)
+++ app/controllers/issues_controller.rb	(working copy)
@@ -129,15 +129,26 @@
   # Add a new issue
   # The new issue will be created from an existing one if copy_from parameter is given
   def new
-    respond_to do |format|
-      format.html { render :action => 'new', :layout => !request.xhr? }
-      format.js { render :partial => 'attributes' }
+    if params[:copy_from]
+       respond_to do |format|
+        format.html { render :action => 'new',:copy_from => params[:copy_from], :layout => !request.xhr? }
+        format.js { render :partial => 'attributes' }
+      end
+   
+    else
+      respond_to do |format|
+        format.html { render :action => 'new', :layout => !request.xhr? }
+        format.js { render :partial => 'attributes' }
+      end
     end
   end
 
   def create
+    
     call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue })
     if @issue.save
+      @issue.copy_attachment(params[:copy_from]) if params[:copy_from]
+      @issue.copy_notes(params[:copy_from]) if params[:copy_from]
       attachments = Attachment.attach_files(@issue, params[:attachments])
       render_attachment_warning_if_needed(@issue)
       flash[:notice] = l(:notice_successful_create)

Index: app/views/issues/new.rhtml
===================================================================
--- app/views/issues/new.rhtml	(revision 6631)
+++ app/views/issues/new.rhtml	(working copy)
@@ -1,6 +1,6 @@
 <h2><%=l(:label_issue_new)%></h2>
 
-<% labelled_tabular_form_for :issue, @issue, :url => {:controller => 'issues', :action => 'create', :project_id => @project},
+<% labelled_tabular_form_for :issue, @issue, :url => {:controller => 'issues', :action => 'create',:copy_from => params[:copy_from], :project_id => @project},
                              :html => {:multipart => true, :id => 'issue-form', :class => 'tabular new-issue-form'} do |f| %>
     <%= error_messages_for 'issue' %>
     <div class="box">

 
