]> source.dussan.org Git - redmine.git/commitdiff
Fixed that the bulk edit form shows additional custom fields (#19163).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 21 Mar 2015 09:26:18 +0000 (09:26 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 21 Mar 2015 09:26:18 +0000 (09:26 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@14151 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/issues_controller.rb
test/functional/issues_controller_test.rb

index d38b69dd1a0bfada189ca795746399502bbd990f..c314b7809e4f5b9205b22c13bf8bf9c7d9736532 100644 (file)
@@ -229,7 +229,7 @@ class IssuesController < ApplicationController
     else
       @available_statuses = @issues.map(&:new_statuses_allowed_to).reduce(:&)
     end
-    @custom_fields = target_projects.map{|p|p.all_issue_custom_fields.visible}.reduce(:&)
+    @custom_fields = @issue..map{|p|p.all_issue_custom_fields.visible}.reduce(:&)
     @assignables = target_projects.map(&:assignable_users).reduce(:&)
     @trackers = target_projects.map(&:trackers).reduce(:&)
     @versions = target_projects.map {|p| p.shared_versions.open}.reduce(:&)
index dc3bd4861bdd2b129fe421f3ab070a33d54a446b..cab5331382f515b447eabf8a649cd40685b250f9 100644 (file)
@@ -3536,6 +3536,17 @@ class IssuesControllerTest < ActionController::TestCase
     end
   end
 
+  def test_bulk_edit_should_only_propose_issues_trackers_custom_fields
+    IssueCustomField.delete_all
+    field = IssueCustomField.generate!(:tracker_ids => [1], :is_for_all => true)
+    IssueCustomField.generate!(:tracker_ids => [2], :is_for_all => true)
+    @request.session[:user_id] = 2
+
+    issue_ids = Issue.where(:project_id => 1, :tracker_id => 1).limit(2).ids
+    get :bulk_edit, :ids => issue_ids
+    assert_equal [field], assigns(:custom_fields)
+  end
+
   def test_bulk_update
     @request.session[:user_id] = 2
     # update issues priority