mirror of
https://github.com/redmine/redmine.git
synced 2026-05-07 06:15:48 +02:00
Merged r9404, r9405 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@9411 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -225,12 +225,19 @@ class IssuesController < ApplicationController
|
||||
end
|
||||
target_projects ||= @projects
|
||||
|
||||
@available_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&)
|
||||
if @copy
|
||||
@available_statuses = [IssueStatus.default]
|
||||
else
|
||||
@available_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&)
|
||||
end
|
||||
@custom_fields = target_projects.map{|p|p.all_issue_custom_fields}.reduce(:&)
|
||||
@assignables = target_projects.map(&:assignable_users).reduce(:&)
|
||||
@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?
|
||||
@@ -246,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
|
||||
|
||||
@@ -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
|
||||
@@ -511,24 +511,28 @@ class Issue < ActiveRecord::Base
|
||||
|
||||
# Returns an array of statuses that user is able to apply
|
||||
def new_statuses_allowed_to(user=User.current, include_default=false)
|
||||
initial_status = nil
|
||||
if new_record?
|
||||
initial_status = IssueStatus.default
|
||||
elsif status_id_was
|
||||
initial_status = IssueStatus.find_by_id(status_id_was)
|
||||
if new_record? && @copied_from
|
||||
[IssueStatus.default, @copied_from.status].compact.uniq.sort
|
||||
else
|
||||
initial_status = nil
|
||||
if new_record?
|
||||
initial_status = IssueStatus.default
|
||||
elsif status_id_was
|
||||
initial_status = IssueStatus.find_by_id(status_id_was)
|
||||
end
|
||||
initial_status ||= status
|
||||
|
||||
statuses = initial_status.find_new_statuses_allowed_to(
|
||||
user.admin ? Role.all : user.roles_for_project(project),
|
||||
tracker,
|
||||
author == user,
|
||||
assigned_to_id_changed? ? assigned_to_id_was == user.id : assigned_to_id == user.id
|
||||
)
|
||||
statuses << initial_status unless statuses.empty?
|
||||
statuses << IssueStatus.default if include_default
|
||||
statuses = statuses.compact.uniq.sort
|
||||
blocked? ? statuses.reject {|s| s.is_closed?} : statuses
|
||||
end
|
||||
initial_status ||= status
|
||||
|
||||
statuses = initial_status.find_new_statuses_allowed_to(
|
||||
user.admin ? Role.all : user.roles_for_project(project),
|
||||
tracker,
|
||||
author == user,
|
||||
assigned_to_id_changed? ? assigned_to_id_was == user.id : assigned_to_id == user.id
|
||||
)
|
||||
statuses << initial_status unless statuses.empty?
|
||||
statuses << IssueStatus.default if include_default
|
||||
statuses = statuses.compact.uniq.sort
|
||||
blocked? ? statuses.reject {|s| s.is_closed?} : statuses
|
||||
end
|
||||
|
||||
def assigned_to_was
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user