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
[#66093] Error message contains custom field with missing value
Tobias Dillmann7b7cca512ca3
diff --git a/app/models/calculated_value_error.rb b/app/models/calculated_value_error.rbindex aff056e975e..5e6765d0502 100644--- a/app/models/calculated_value_error.rb+++ b/app/models/calculated_value_error.rb@@ -49,7 +49,19 @@ class CalculatedValueError < ApplicationRecorddef error_messagetranslation_key = ERROR_TRANSLATIONS.fetch(error_code, "calculated_values.errors.unknown")+ translation_options = {}- I18n.t(translation_key)+ if error_code == "ERROR_MISSING_VALUE"+ # To keep the error message short, we only show the first custom field with a missing value.+ cf = CustomField.find(missing_custom_field_ids.first)++ if cf+ translation_options[:custom_field_name] = cf.name+ else+ translation_key = "calculated_values.errors.unknown"+ end+ end++ I18n.t(translation_key, **translation_options)endenddiff --git a/config/locales/en.yml b/config/locales/en.ymlindex 41df72858bb..640243568b7 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -364,7 +364,7 @@ en:errors:unknown: "An unknown error occurred during calculation. Please review the formula and try again."mathematical: "A mathematical error occurred during calculation. Please review the formula and try again."- missing_value: "The attribute TODO is not set. Please set all attributes required for the calculation."+ missing_value: "The attribute %{custom_field_name} is not set. Please set all attributes required for the calculation."concatenation:single: "or"