From d0ea5fae62b16c50ac86445368be0cc7b87e295a Mon Sep 17 00:00:00 2001
From: Jean-Philippe Lang <%= custom_field_tag_for_bulk_edit('issue', custom_field) %> <%= custom_field_tag_for_bulk_edit('issue', custom_field, @projects) %>
<%= custom_field_tag_for_bulk_edit('time_entry', custom_field) %>
+<%= custom_field_tag_for_bulk_edit('time_entry', custom_field, @projects) %>
<% end %> <%= call_hook(:view_time_entries_bulk_edit_details_bottom, { :time_entries => @time_entries }) %> diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 4c6e33266..31132eba0 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -1,5 +1,5 @@ # Redmine - project management software -# Copyright (C) 2006-2008 Jean-Philippe Lang +# Copyright (C) 2006-2011 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -1123,6 +1123,38 @@ class IssuesControllerTest < ActionController::TestCase assert !field.project_ids.include?(Issue.find(6).project_id) assert_no_tag :input, :attributes => {:name => 'issue[custom_field_values][9]'} end + + def test_get_bulk_edit_with_user_custom_field + field = IssueCustomField.create!(:name => 'Tester', :field_format => 'user', :is_for_all => true) + + @request.session[:user_id] = 2 + get :bulk_edit, :ids => [1, 2] + assert_response :success + assert_template 'bulk_edit' + + assert_tag :select, + :attributes => {:name => "issue[custom_field_values][#{field.id}]"}, + :children => { + :only => {:tag => 'option'}, + :count => Project.find(1).users.count + 1 + } + end + + def test_get_bulk_edit_with_version_custom_field + field = IssueCustomField.create!(:name => 'Affected version', :field_format => 'version', :is_for_all => true) + + @request.session[:user_id] = 2 + get :bulk_edit, :ids => [1, 2] + assert_response :success + assert_template 'bulk_edit' + + assert_tag :select, + :attributes => {:name => "issue[custom_field_values][#{field.id}]"}, + :children => { + :only => {:tag => 'option'}, + :count => Project.find(1).versions.count + 1 + } + end def test_bulk_update @request.session[:user_id] = 2 diff --git a/test/unit/custom_field_user_format_test.rb b/test/unit/custom_field_user_format_test.rb index 5cc4ea5c1..8cac3009f 100644 --- a/test/unit/custom_field_user_format_test.rb +++ b/test/unit/custom_field_user_format_test.rb @@ -53,6 +53,13 @@ class CustomFieldUserFormatTest < ActiveSupport::TestCase assert_equal project.users.sort.map {|u| [u.name, u.id.to_s]}, possible_values_options end + def test_possible_values_options_with_array + projects = Project.find([1, 2]) + possible_values_options = @field.possible_values_options(projects) + assert possible_values_options.any? + assert_equal (projects.first.users & projects.last.users).sort.map {|u| [u.name, u.id.to_s]}, possible_values_options + end + def test_cast_blank_value assert_equal nil, @field.cast_value(nil) assert_equal nil, @field.cast_value("") -- 2.39.5