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
[#64347] add new format "calculated_value" to project attribute list
Tobias Dillmann6634ef3a7366
diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 74c2e03e86f..ad8b83e97bf 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -2721,6 +2721,7 @@ en:label_select_main_menu_item: Select new main menu itemlabel_required_disk_storage: "Required disk storage"label_send_invitation: Send invitation+ label_calculated_value: "Calculated value"label_change_plural: "Changes"label_change_properties: "Change properties"label_change_status: "Change status"diff --git a/lib/open_project/custom_field_format.rb b/lib/open_project/custom_field_format.rbindex 3130617ba15..354c5e3456b 100644--- a/lib/open_project/custom_field_format.rb+++ b/lib/open_project/custom_field_format.rb@@ -80,6 +80,17 @@ module OpenProjectavailable.keysend+ # TODO: Consider changing the initializer order and moving this to the CustomFieldFormat initializer instead+ def ensure_calculated_value_if_active!+ if OpenProject::FeatureDecisions.calculated_value_project_attribute_active? && !@@available.key?("calculated_value")+ order_of_last_entry = @@available.values.last.order+ register OpenProject::CustomFieldFormat.new("calculated_value",+ label: :label_calculated_value,+ only: %w(Project),+ order: order_of_last_entry + 1)+ end+ end+def find_by(name:)registered[name.to_s]end