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

Correctly show entity_gid in the table

Klaus Zanderscd6eb7a0fb84
diff --git a/modules/reporting/app/helpers/reporting_helper.rb b/modules/reporting/app/helpers/reporting_helper.rb
index e838a7a762a..d0ce8286e5b 100644
--- a/modules/reporting/app/helpers/reporting_helper.rb
+++ b/modules/reporting/app/helpers/reporting_helper.rb
@@ -192,7 +192,8 @@ module ReportingHelper
return "" if value.blank?
case key.to_sym
- when :work_package_id, :entity_id, :tweek, :tmonth, :week then value.to_i
+ when :entity_id, :tweek, :tmonth, :week then value.to_i
+ when :entity_gid then GlobalID.new(value).model_id.to_i
when :spent_on then value.to_date.mjd
else strip_tags(field_representation_map(key, value))
end
diff --git a/modules/reporting/app/models/cost_query/result.rb b/modules/reporting/app/models/cost_query/result.rb
index 1f0a309aa6e..e039ed8ee70 100644
--- a/modules/reporting/app/models/cost_query/result.rb
+++ b/modules/reporting/app/models/cost_query/result.rb
@@ -68,6 +68,10 @@ class CostQuery::Result < Report::Result
start + self["units"].to_f.hours
end
+ def entity_gid
+ "gid://#{GlobalID.app}/#{self['entity_type']}/#{self['entity_id']}"
+ end
+
private
def timestamp(date, time, time_zone)
diff --git a/modules/reporting/lib/widget/table/entry_table.rb b/modules/reporting/lib/widget/table/entry_table.rb
index 57345af3245..10cb1a5033d 100644
--- a/modules/reporting/lib/widget/table/entry_table.rb
+++ b/modules/reporting/lib/widget/table/entry_table.rb
@@ -29,7 +29,7 @@
class Widget::Table::EntryTable < Widget::Table
include ReportingHelper
- FIELDS = %i[user_id activity_id entity_id comments logged_by_id project_id].freeze
+ FIELDS = %i[user_id activity_id entity_gid comments logged_by_id project_id].freeze
def render
content = content_tag :div, class: "generic-table--container -with-footer" do