]> source.dussan.org Git - redmine.git/commitdiff
Wrong columns after CSV export (#26785).
authorGo MAEDA <maeda@farend.jp>
Tue, 4 Dec 2018 09:23:18 +0000 (09:23 +0000)
committerGo MAEDA <maeda@farend.jp>
Tue, 4 Dec 2018 09:23:18 +0000 (09:23 +0000)
Patch by Mizuki ISHIKAWA.

git-svn-id: http://svn.redmine.org/redmine/trunk@17686 e93f8b46-1217-0410-a6f0-8f06a7374b81

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

index e1a3d860c08ac2acc1149ff017a49725fba24ca0..69a947b031afae8d0823bc5745abca1e543cb105 100644 (file)
@@ -40,7 +40,8 @@ class IssuesController < ApplicationController
   helper :timelog
 
   def index
-    retrieve_query
+    use_session = !request.format.csv?
+    retrieve_query(IssueQuery, use_session)
 
     if @query.valid?
       respond_to do |format|
index 872db7a1daedf67bcb26195e647ee32b5440497c..377ee1fb1dbd8ab6a5eade01606cd3c09da62a11 100644 (file)
@@ -803,6 +803,25 @@ class IssuesControllerTest < Redmine::ControllerTest
     end
   end
 
+  def test_index_csv_should_not_change_selected_columns
+    get :index, :params => {
+        :set_filter => 1,
+        :c => ["subject", "due_date"],
+        :project_id => "ecookbook"
+      }
+    assert_response :success
+    assert_equal [:subject, :due_date], session[:issue_query][:column_names]
+
+    get :index, :params => {
+        :set_filter => 1,
+        :c =>["all_inline"],
+        :project_id => "ecookbook",
+        :format => 'csv'
+      }
+    assert_response :success
+    assert_equal [:subject, :due_date], session[:issue_query][:column_names]
+  end
+
   def test_index_pdf
     ["en", "zh", "zh-TW", "ja", "ko"].each do |lang|
       with_settings :default_language => lang do