From: Jean-Philippe Lang Date: Sat, 9 Jul 2016 02:08:39 +0000 (+0000) Subject: Wrong filters are applied when exporting issues to CSV with blank filter (#23206). X-Git-Tag: 3.4.0~845 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4c78b63d58b7f7fd71b34d88c0aea6dc1fdf76ad;p=redmine.git Wrong filters are applied when exporting issues to CSV with blank filter (#23206). Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@15608 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/helpers/queries_helper.rb b/app/helpers/queries_helper.rb index fd92af17a..0bea000db 100644 --- a/app/helpers/queries_helper.rb +++ b/app/helpers/queries_helper.rb @@ -257,6 +257,8 @@ module QueriesHelper tags << hidden_field_tag("v[#{field}][]", value, :id => nil) end end + else + tags << hidden_field_tag("f[]", "", :id => nil) end if query.column_names.present? query.column_names.each do |name| diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 046efb856..83cdb27ac 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -488,6 +488,9 @@ class IssuesControllerTest < ActionController::TestCase assert_select 'input[name=?][value=?]', 'sort', 'status' end + + get :index, :project_id => 1, :set_filter => "1", :f => [] + assert_select '#csv-export-form input[name=?][value=?]', 'f[]', '' end def test_index_csv @@ -507,6 +510,14 @@ class IssuesControllerTest < ActionController::TestCase assert_equal 'text/csv; header=present', @response.content_type end + def test_index_csv_without_any_filters + @request.session[:user_id] = 1 + Issue.create!(:project_id => 1, :tracker_id => 1, :status_id => 5, :subject => 'Closed issue', :author_id => 1) + get :index, :set_filter => 1, :f => [], :format => 'csv' + assert_response :success + assert_equal Issue.count, assigns(:issues).count + end + def test_index_csv_with_description Issue.generate!(:description => 'test_index_csv_with_description')