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
Link values in overview to the corresponding day in the details tables
as-opf56ae32558fe
diff --git a/app/models/work_package/pdf_export/common/common.rb b/app/models/work_package/pdf_export/common/common.rbindex bd6a0130475..0afd576868c 100644--- a/app/models/work_package/pdf_export/common/common.rb+++ b/app/models/work_package/pdf_export/common/common.rb@@ -316,4 +316,17 @@ module WorkPackage::PDFExport::Common::Commondef wp_status_prawn_color(work_package)work_package.status.color&.hexcode&.sub("#", "") || "F0F0F0"end++ def add_pdf_table_anchors(prawn_table)+ # prawn table does not support anchors, so we have to add them manually,+ # @see `lib/open_project/patches/prawn_table_cell.rb` for cell_id attribute+ prawn_table.before_rendering_page do |cells|+ cells.each do |cell|+ if cell.respond_to?(:cell_id) && cell.cell_id.present?+ pdf_dest = @pdf.dest_xyz(@pdf.bounds.absolute_left, @pdf.y + cell.y)+ @pdf.add_dest(cell.cell_id, pdf_dest)+ end+ end+ end+ endenddiff --git a/lib/open_project/patches/prawn_table_cell.rb b/lib/open_project/patches/prawn_table_cell.rbnew file mode 100644index 00000000000..b33a039f8b4--- /dev/null+++ b/lib/open_project/patches/prawn_table_cell.rb@@ -0,0 +1,35 @@+# frozen_string_literal: true++#-- 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 OpenProject::Patches::PrawnTableCellPatch+ attr_accessor :cell_id+end++Prawn::Table::Cell.prepend(OpenProject::Patches::PrawnTableCellPatch)diff --git a/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb b/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rbindex 7a823b71a81..eccd65ea859 100644--- a/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb+++ b/modules/reporting/app/workers/cost_query/pdf/timesheet_generator.rb@@ -191,7 +191,8 @@ class CostQuery::PDF::TimesheetGenerator[{content: format_date_with_weekday(spent_on),- rowspan: (entry.comments.present? ? 2 : 1)+ rowspan: (entry.comments.present? ? 2 : 1),+ cell_id: spent_on_day_id(entry.user, spent_on)},build_table_subject_cell(entry),with_times_column? ? format_spent_on_time(entry) : nil,@@ -210,6 +211,10 @@ class CostQuery::PDF::TimesheetGenerator].compactend+ def spent_on_day_id(user, spent_on)+ "entry_#{user.id}_#{spent_on}"+ end+def build_table_subject_cell(entry)return "" if entry.work_package.nil?@@ -267,7 +272,7 @@ class CostQuery::PDF::TimesheetGeneratorendend- def build_table(rows, has_sum_row)+ def build_table(rows, has_sum_row, with_anchors)pdf.make_table(rows,header: true,@@ -286,6 +291,7 @@ class CostQuery::PDF::TimesheetGeneratoradjust_borders_spanned_column(table)adjust_border_header_row(table)adjust_border_sum_row(table) if has_sum_row+ add_pdf_table_anchors(table) if with_anchorsendend@@ -327,7 +333,7 @@ class CostQuery::PDF::TimesheetGeneratorenddef split_group_rows(table_rows, has_sum_row)- measure_table = build_table(table_rows, has_sum_row)+ measure_table = build_table(table_rows, has_sum_row, false)groups = []index = 0while index < table_rows.length@@ -393,7 +399,7 @@ class CostQuery::PDF::TimesheetGeneratorcurrent_table = []merge_first_columns(grouped_rows)grouped_rows.map! { |row| current_table.concat(row[:rows]) }- build_table(current_table, has_sum_row).draw+ build_table(current_table, has_sum_row, true).drawenddef merge_first_columns(grouped_rows)@@ -479,9 +485,9 @@ class CostQuery::PDF::TimesheetGenerator[format_date_with_weekday(date)] + rowend- def build_sum_table_sum_cell(sum, _user, _date)+ def build_sum_table_sum_cell(sum, user, date){- content: format_hours(sum),+ content: make_link_anchor(spent_on_day_id(user, date), format_hours(sum)),align: :right, inline_format: true}end