From 4ddafd761dd485d7086b0f7efc98ef2ced044730 Mon Sep 17 00:00:00 2001 From: Marius BALTEANU Date: Tue, 3 Mar 2020 00:25:00 +0200 Subject: [PATCH] Fix missing subject and tracker name in CSV export of time entries report --- app/helpers/timelog_helper.rb | 10 +++++++++- test/functional/timelog_report_test.rb | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rb index d10b57332..e0cc51d27 100644 --- a/app/helpers/timelog_helper.rb +++ b/app/helpers/timelog_helper.rb @@ -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 diff --git a/test/functional/timelog_report_test.rb b/test/functional/timelog_report_test.rb index e9c13b311..68ef80622 100644 --- a/test/functional/timelog_report_test.rb +++ b/test/functional/timelog_report_test.rb @@ -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) -- 2.22.0