diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-04-14 06:21:03 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-04-14 06:21:03 +0000 |
commit | 231282ddcb73e9baaab76496bf2605a80594da36 (patch) | |
tree | 7743a570122b38edf288eb275ebd1d9076efa88d /app | |
parent | 09375960d69dcca6dafe4b126b77994f523efba8 (diff) | |
download | redmine-231282ddcb73e9baaab76496bf2605a80594da36.tar.gz redmine-231282ddcb73e9baaab76496bf2605a80594da36.zip |
Fixed MissingFeatureException: let user choose to copy attachments or not when bulk copying issues.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9405 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/issues_controller.rb | 5 | ||||
-rw-r--r-- | app/models/issue.rb | 4 | ||||
-rw-r--r-- | app/views/issues/bulk_edit.html.erb | 7 |
3 files changed, 13 insertions, 3 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index 84ff8fd23..cffb69b61 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -235,6 +235,9 @@ class IssuesController < ApplicationController @trackers = target_projects.map(&:trackers).reduce(:&) @versions = target_projects.map {|p| p.shared_versions.open}.reduce(:&) @categories = target_projects.map {|p| p.issue_categories}.reduce(:&) + if @copy + @attachments_present = @issues.detect {|i| i.attachments.any?}.present? + end @safe_attributes = @issues.map(&:safe_attribute_names).reduce(:&) render :layout => false if request.xhr? @@ -250,7 +253,7 @@ class IssuesController < ApplicationController @issues.each do |issue| issue.reload if @copy - issue = issue.copy + issue = issue.copy({}, :attachments => params[:copy_attachments].present?) end journal = issue.init_journal(User.current, params[:notes]) issue.safe_attributes = attributes diff --git a/app/models/issue.rb b/app/models/issue.rb index 8ebc20fc0..d72ff4dcf 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -145,8 +145,8 @@ class Issue < ActiveRecord::Base end # Returns an unsaved copy of the issue - def copy(attributes=nil) - copy = self.class.new.copy_from(self) + def copy(attributes=nil, copy_options={}) + copy = self.class.new.copy_from(self, copy_options) copy.attributes = attributes if attributes copy end diff --git a/app/views/issues/bulk_edit.html.erb b/app/views/issues/bulk_edit.html.erb index 0263ab916..e81676ada 100644 --- a/app/views/issues/bulk_edit.html.erb +++ b/app/views/issues/bulk_edit.html.erb @@ -60,6 +60,13 @@ <p><label><%= h(custom_field.name) %></label> <%= custom_field_tag_for_bulk_edit('issue', custom_field, @projects) %></p> <% end %> +<% if @copy && @attachments_present %> +<p> + <label for='copy_attachments'><%= l(:label_copy_attachments) %></label> + <%= check_box_tag 'copy_attachments', '1', true %> +</p> +<% end %> + <%= call_hook(:view_issues_bulk_edit_details_bottom, { :issues => @issues }) %> </div> |