Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[41823] Export long text CF as plain markdown

Oliver Güntherf75f120725b4
diff --git a/app/models/exports/formatters/custom_field.rb b/app/models/exports/formatters/custom_field.rb
index 03984842620..393d9e42a76 100644
--- a/app/models/exports/formatters/custom_field.rb
+++ b/app/models/exports/formatters/custom_field.rb
@@ -16,10 +16,12 @@ module Exports
##
# Print the value meant for export.
- # For boolean values, don't use the Yes/No formatting for the UI
+ #
+ # - For boolean values, don't use the Yes/No formatting for the UI
+ # - For long text values, output the plain value
def format_for_export(object, custom_field)
case custom_field.field_format
- when 'bool'
+ when 'bool', 'text'
object.typed_custom_value_for(custom_field)
else
object.formatted_custom_value_for(custom_field)
diff --git a/modules/xls_export/spec/models/xls_export/project/exporter/xls_integration_spec.rb b/modules/xls_export/spec/models/xls_export/project/exporter/xls_integration_spec.rb
index 0b7e2c6718d..7a3b12e6b96 100644
--- a/modules/xls_export/spec/models/xls_export/project/exporter/xls_integration_spec.rb
+++ b/modules/xls_export/spec/models/xls_export/project/exporter/xls_integration_spec.rb
@@ -43,8 +43,11 @@ describe XlsExport::Project::Exporter::XLS do
expect(header).to eq ['ID', 'Identifier', 'Name', 'Status', 'Public', *cf_names]
custom_values = custom_fields.map do |cf|
- if cf == bool_cf
+ case cf
+ when bool_cf
'true'
+ when text_cf
+ project.typed_custom_value_for(cf)
else
project.formatted_custom_value_for(cf)
end
diff --git a/spec/models/projects/exporter/csv_integration_spec.rb b/spec/models/projects/exporter/csv_integration_spec.rb
index dba68a0d217..e2dd8f3189a 100644
--- a/spec/models/projects/exporter/csv_integration_spec.rb
+++ b/spec/models/projects/exporter/csv_integration_spec.rb
@@ -59,8 +59,11 @@ describe Projects::Exports::CSV, 'integration', type: :model do
expect(header).to eq ['id', 'Identifier', 'Name', 'Status', 'Public', *cf_names]
custom_values = custom_fields.map do |cf|
- if cf == bool_cf
+ case cf
+ when bool_cf
'true'
+ when text_cf
+ project.typed_custom_value_for(cf)
else
project.formatted_custom_value_for(cf)
end