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
do not split date-field (combined as in the web), remove duration
as-opf59c5383a0a1
diff --git a/app/models/work_package/exports/formatters/date.rb b/app/models/work_package/exports/formatters/date.rbnew file mode 100644index 00000000000..21419e8fada--- /dev/null+++ b/app/models/work_package/exports/formatters/date.rb@@ -0,0 +1,42 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#+++module WorkPackage::Exports+ module Formatters+ class Date < ::Exports::Formatters::Default+ include WorkPackagesHelper++ def self.apply?(name, export_format)+ name.to_sym == :date && export_format == :pdf+ end++ def format(work_package, **)+ work_package_formatted_dates(work_package)+ end+ end+ end+enddiff --git a/app/models/work_package/pdf_export/export/wp/attributes.rb b/app/models/work_package/pdf_export/export/wp/attributes.rbindex 8e7a07f9c75..c37e873208b 100644--- a/app/models/work_package/pdf_export/export/wp/attributes.rb+++ b/app/models/work_package/pdf_export/export/wp/attributes.rb@@ -216,18 +216,14 @@ module WorkPackage::PDFExport::Export::Wp::Attributesenddef form_key_to_column_entries(form_key, work_package)+ return [] if form_key == :bcf_thumbnail+if CustomField.custom_field_attribute? form_keyreturn form_key_custom_field_to_column_entries(form_key, work_package)end- if form_key == :date- column_entries(%i[start_date due_date duration])- elsif form_key == :bcf_thumbnail- []- else- column_name = ::API::Utilities::PropertyNameConverter.to_ar_name(form_key, context: work_package)- [column_entry(column_name)]- end+ column_name = ::API::Utilities::PropertyNameConverter.to_ar_name(form_key, context: work_package)+ [column_entry(column_name)]enddef column_entries(column_names)diff --git a/config/initializers/export_formats.rb b/config/initializers/export_formats.rbindex ae50c624cb3..2883730b622 100644--- a/config/initializers/export_formats.rb+++ b/config/initializers/export_formats.rb@@ -14,6 +14,7 @@ Rails.application.configure do |application|formatter WorkPackage, WorkPackage::Exports::Formatters::Currencyformatter WorkPackage, WorkPackage::Exports::Formatters::Costsformatter WorkPackage, WorkPackage::Exports::Formatters::DoneRatio+ formatter WorkPackage, WorkPackage::Exports::Formatters::Dateformatter WorkPackage, Exports::Formatters::CustomFieldformatter WorkPackage, Exports::Formatters::CustomFieldPdfdiff --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 cc027c520ba..d0e49c3b438 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@@ -137,7 +137,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf dotype:,subject: "Work package 1",start_date: "2024-05-30",- due_date: "2024-05-30",+ due_date: "2025-03-13",created_at: export_time,updated_at: export_time,author: user,@@ -215,9 +215,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf do"Priority", "Normal","Version", work_package.version,"Category", work_package.category,- "Start date", "05/30/2024",- "Finish date", "05/30/2024",- "Duration", "1 d",+ "Date", "05/30/2024 - 03/13/2025","Other","Work Package Custom Field Boolean", "Yes","Work Package Custom Field Long Text", "foo faa",@@ -296,7 +294,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf do["remainingTime", "9h"],["version", version.name],["responsible", user.name],- ["dueDate", "05/30/2024"],+ ["dueDate", "03/13/2025"],["spentTime", "0h"],["startDate", "05/30/2024"],["parent", "#{type.name} ##{parent_work_package.id}: #{parent_work_package.name}"],