]> source.dussan.org Git - redmine.git/commitdiff
Fix missing subject and tracker name in CSV export of time (#33052).
authorGo MAEDA <maeda@farend.jp>
Wed, 4 Mar 2020 07:10:07 +0000 (07:10 +0000)
committerGo MAEDA <maeda@farend.jp>
Wed, 4 Mar 2020 07:10:07 +0000 (07:10 +0000)
Patch by Kevin Fischer and Marius BALTEANU.

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

app/helpers/timelog_helper.rb
test/functional/timelog_report_test.rb

index 4e0e7206fe5856672ff27b6ef21d99c2879391b7..fe5acb8f6ea0ea399d2bf10826042d948e121bfb 100644 (file)
@@ -68,7 +68,15 @@ module TimelogHelper
       "[#{l(:label_none)}]"
     elsif k = criteria_options[:klass]
       obj = k.find_by_id(value.to_i)
-      format_object(obj, html)
+      if obj.is_a?(Issue)
+        if obj.visible?
+          html ? link_to_issue(obj) : "#{obj.tracker} ##{obj.id}: #{obj.subject}"
+        else
+          "##{obj.id}"
+        end
+      else
+        format_object(obj, html)
+      end
     elsif cf = criteria_options[:custom_field]
       format_value(value, cf)
     else
index f4764faed1a1636c17f7cfa7c9a3e233f9058119..3777f0c0c5d90c66aff5a6b3ec84f751c529774b 100644 (file)
@@ -259,6 +259,21 @@ class TimelogReportTest < Redmine::ControllerTest
     assert_equal 'Total time,"","",154.25,8.65,162.90', lines.last
   end
 
+  def test_report_csv_should_fill_issue_criteria_with_tracker_id_and_subject
+    get :report, :params => {
+      :project_id => 1,
+      :columns => 'month',
+      :from => "2007-01-01",
+      :to => "2007-06-30",
+      :criteria => ["issue"],
+      :format => "csv"
+    }
+
+    assert_response :success
+    lines = @response.body.chomp.split("\n")
+    assert lines.detect {|line| line.include?('Bug #1: Cannot print recipes')}
+  end
+
   def test_csv_big_5
     str_big5  = (+"\xa4@\xa4\xeb").force_encoding('Big5')
     user = User.find_by_id(3)