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

do not throw errors in export for I18n::MissingTranslationData

as-op1569d4f8b034
diff --git a/app/models/work_package/exports/attributes.rb b/app/models/work_package/exports/attributes.rb
index 48f442063d2..cd3d0c5004e 100644
--- a/app/models/work_package/exports/attributes.rb
+++ b/app/models/work_package/exports/attributes.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
@@ -25,6 +27,7 @@
#
# See COPYRIGHT and LICENSE files for more details.
#++
+
module WorkPackage::Exports
module Attributes
def user_allowed_view_wp_project_phase?(work_package)
diff --git a/app/models/work_package/exports/macros/attributes.rb b/app/models/work_package/exports/macros/attributes.rb
index f68eaccdcfa..eb032a68565 100644
--- a/app/models/work_package/exports/macros/attributes.rb
+++ b/app/models/work_package/exports/macros/attributes.rb
@@ -105,6 +105,10 @@ module WorkPackage::Exports
model.human_attribute_name(
::API::Utilities::PropertyNameConverter.to_ar_name(attribute.to_sym, context: model.new)
)
+ rescue I18n::MissingTranslationData
+ # If the translation is missing, we return the attribute name as a fallback
+ # # This can happen if the attribute is a custom field, the attribute is not translated or does not exist
+ attribute.to_s
end
def self.resolve_work_package_match(id, type, attribute, user)