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
[#62556] Long text CF not displayed when empty
as-op26d3e8e106ec
diff --git a/app/models/work_package/pdf_export/export/wp/attributes.rb b/app/models/work_package/pdf_export/export/wp/attributes.rbindex 416b31c6478..255b7c1acc4 100644--- a/app/models/work_package/pdf_export/export/wp/attributes.rb+++ b/app/models/work_package/pdf_export/export/wp/attributes.rb@@ -46,14 +46,10 @@ module WorkPackage::PDFExport::Export::Wp::Attributesdef write_long_text_field!(work_package, field_id)custom_value = work_package.custom_field_values.find { |cv| cv.custom_field.id == field_id && cv.custom_field.formattable? }- if custom_value&.value- write_long_text_custom_field!(work_package, custom_value.value, custom_value.custom_field.name)- end+ write_long_text_custom_field!(work_package, custom_value.value || "", custom_value.custom_field.name)enddef write_long_text_custom_field!(work_package, markdown, label)- return if markdown.blank?-write_optional_page_breakwrite_long_text_custom_field_label(label)write_markdown_field_value(work_package, markdown)diff --git a/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rb b/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rbindex c675da3ad7d..32e64ebe05b 100644--- a/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rb+++ b/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rb@@ -34,7 +34,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf doinclude Redmine::I18ninclude PDFExportSpecUtilslet(:type) do- create(:type_bug, custom_fields: [cf_long_text, cf_disabled_in_project, cf_global_bool])+ create(:type_bug, custom_fields: [cf_long_text, cf_empty_long_text, cf_disabled_in_project, cf_global_bool])endlet(:parent_project) docreate(:project, name: "Parent project")@@ -65,8 +65,8 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf doproject_custom_field_bool.id => true,project_custom_field_long_text.id => "foo"},- work_package_custom_fields: [cf_long_text, cf_disabled_in_project, cf_global_bool],- work_package_custom_field_ids: [cf_long_text.id, cf_global_bool.id]) # cf_disabled_in_project.id is disabled+ work_package_custom_fields: [cf_long_text, cf_empty_long_text, cf_disabled_in_project, cf_global_bool],+ work_package_custom_field_ids: [cf_long_text.id, cf_empty_long_text.id, cf_global_bool.id]) # cf_disabled_in_project.id is disabledendlet(:forbidden_project) docreate(:project,@@ -78,8 +78,8 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf dostatus_code: "on_track",active: true,parent: parent_project,- work_package_custom_fields: [cf_long_text, cf_disabled_in_project, cf_global_bool],- work_package_custom_field_ids: [cf_long_text.id, cf_global_bool.id]) # cf_disabled_in_project.id is disabled+ work_package_custom_fields: [cf_long_text, cf_empty_long_text, cf_disabled_in_project, cf_global_bool],+ work_package_custom_field_ids: [cf_long_text.id, cf_empty_long_text.id, cf_global_bool.id]) # cf_disabled_in_project.id is disabledendlet(:user) docreate(:user,@@ -97,9 +97,12 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf dolet(:image_attachment) { Attachment.new author: user, file: File.open(image_path) }let(:attachments) { [image_attachment] }let(:cf_long_text_description) { "**foo** *faa*" }+ let(:cf_empty_long_text_description) { "" }let(:cf_long_text) do- create(:issue_custom_field, :text,- name: "Work Package Custom Field Long Text")+ create(:issue_custom_field, :text, name: "Work Package Custom Field Long Text")+ end+ let(:cf_empty_long_text) do+ create(:issue_custom_field, :text, name: "Empty Work Package Custom Field Long Text")endlet!(:cf_disabled_in_project) do# NOT enabled by project.work_package_custom_field_ids => NOT in PDF@@ -157,6 +160,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf dodescription:,custom_values: {cf_long_text.id => cf_long_text_description,+ cf_empty_long_text.id => cf_empty_long_text_description,cf_disabled_in_project.id => "6.25",cf_global_bool.id => true}).tap do |wp|@@ -219,6 +223,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf do"Date", "05/30/2024 - 03/13/2025","Other","Work Package Custom Field Boolean", "Yes",+ "Empty Work Package Custom Field Long Text","Work Package Custom Field Long Text", "foo faa","Costs","Spent units", "Labor costs", "Unit costs", "Overall costs", "Budget"@@ -439,9 +444,10 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf doend,"Custom field boolean", I18n.t(:general_text_Yes),"Custom field rich text", "[#{I18n.t('export.macro.rich_text_unsupported')}]",- "Custom field hidden",+"1", export_time_formatted, project.name,+ "Custom field hidden","No replacement of:","projectValue:1:status","projectLabel:status",