mirror of
https://github.com/redmine/redmine.git
synced 2025-11-12 16:26:03 +01:00
Time entries CSV export should include the tracker and subject of the issue (#18269).
git-svn-id: http://svn.redmine.org/redmine/trunk@13562 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -122,16 +122,20 @@ module QueriesHelper
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def csv_value(column, issue, value)
|
def csv_value(column, object, value)
|
||||||
format_object(value, false) do |value|
|
format_object(value, false) do |value|
|
||||||
case value.class.name
|
case value.class.name
|
||||||
when 'Float'
|
when 'Float'
|
||||||
sprintf("%.2f", value).gsub('.', l(:general_csv_decimal_separator))
|
sprintf("%.2f", value).gsub('.', l(:general_csv_decimal_separator))
|
||||||
when 'IssueRelation'
|
when 'IssueRelation'
|
||||||
other = value.other_issue(issue)
|
other = value.other_issue(object)
|
||||||
l(value.label_for(issue)) + " ##{other.id}"
|
l(value.label_for(object)) + " ##{other.id}"
|
||||||
when 'Issue'
|
when 'Issue'
|
||||||
|
if object.is_a?(TimeEntry)
|
||||||
|
"#{value.tracker} ##{value.id}: #{value.subject}"
|
||||||
|
else
|
||||||
value.id
|
value.id
|
||||||
|
end
|
||||||
else
|
else
|
||||||
value
|
value
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -716,4 +716,14 @@ class TimelogControllerTest < ActionController::TestCase
|
|||||||
assert_equal 'text/csv; header=present', response.content_type
|
assert_equal 'text/csv; header=present', response.content_type
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_index_csv_should_fill_issue_column_with_tracker_id_and_subject
|
||||||
|
issue = Issue.find(1)
|
||||||
|
entry = TimeEntry.generate!(:issue => issue, :comments => "Issue column content test")
|
||||||
|
|
||||||
|
get :index, :format => 'csv'
|
||||||
|
line = response.body.split("\n").detect {|l| l.include?(entry.comments)}
|
||||||
|
assert_not_nil line
|
||||||
|
assert_include "#{issue.tracker} #1: #{issue.subject}", line
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user