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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Use true/false for boolean type CFs
Oliver Günther4c527c273a98
diff --git a/app/models/exports/formatters/custom_field.rb b/app/models/exports/formatters/custom_field.rbindex ef6e3ba604b..03984842620 100644--- a/app/models/exports/formatters/custom_field.rb+++ b/app/models/exports/formatters/custom_field.rb@@ -11,7 +11,19 @@ module Exportscustom_field = find_custom_field(object)return '' if custom_field.nil?- object.formatted_custom_value_for(custom_field)+ format_for_export(object, custom_field)+ end++ ##+ # Print the value meant for export.+ # For boolean values, don't use the Yes/No formatting for the UI+ def format_for_export(object, custom_field)+ case custom_field.field_format+ when 'bool'+ object.typed_custom_value_for(custom_field)+ else+ object.formatted_custom_value_for(custom_field)+ endend##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.rbindex f0ed5037c8e..0b7e2c6718d 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@@ -42,7 +42,14 @@ describe XlsExport::Project::Exporter::XLS docf_names = custom_fields.map(&:name)expect(header).to eq ['ID', 'Identifier', 'Name', 'Status', 'Public', *cf_names]- custom_values = custom_fields.map { |cf| project.formatted_custom_value_for(cf) }+ custom_values = custom_fields.map do |cf|+ if cf == bool_cf+ 'true'+ else+ project.formatted_custom_value_for(cf)+ end+ end+expect(sheet.row(1)).to eq [project.id.to_s, project.identifier, project.name, 'Off track', 'false', *custom_values]enddiff --git a/spec/models/projects/exporter/csv_integration_spec.rb b/spec/models/projects/exporter/csv_integration_spec.rbindex 7fa4e946513..225df104de9 100644--- a/spec/models/projects/exporter/csv_integration_spec.rb+++ b/spec/models/projects/exporter/csv_integration_spec.rb@@ -60,7 +60,13 @@ describe Projects::Exports::CSV, 'integration', type: :model docf_names = custom_fields.map(&:name)expect(header).to eq ['id', 'Identifier', 'Name', 'Status', 'Public', *cf_names]- custom_values = custom_fields.map { |cf| project.formatted_custom_value_for(cf) }+ custom_values = custom_fields.map do |cf|+ if cf == bool_cf+ 'true'+ else+ project.formatted_custom_value_for(cf)+ end+ endexpect(rows.first).to eq [project.id.to_s, project.identifier, project.name, 'Off track', 'false', *custom_values]end