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
use filtered columns for related work package in xls export
ulfertsbd52920548e9
diff --git a/modules/xls_export/lib/open_project/xls_export/work_package_xls_export.rb b/modules/xls_export/lib/open_project/xls_export/work_package_xls_export.rbindex b899edafbd9..bdefc216cf5 100644--- a/modules/xls_export/lib/open_project/xls_export/work_package_xls_export.rb+++ b/modules/xls_export/lib/open_project/xls_export/work_package_xls_export.rb@@ -67,6 +67,10 @@ module OpenProjectenddef row(work_package)+ column_values(work_package)+ end++ def column_values(work_package)columns.collect do |column|column_value column, work_packageend@@ -139,15 +143,18 @@ module OpenProjectmodule WithRelationsdef add_headers!(spreadsheet)headers_0 = [I18n.t(:label_work_package_plural)] +- columns.size.times.map { |_| "" } +- [I18n.t("js.work_packages.tabs.relations")]+ columns.size.times.map { |_| "" } ++ [I18n.t("js.work_packages.tabs.relations")]spreadsheet.add_headers headers_0, 0spreadsheet.add_headers headers, 1enddef headers- [""] + super + [""] + with_relations_headers+ # The filtered work packages columns ++ # the relations columns ++ # the columns of the work packages connected by the relations.+ [""] + super + [""] + with_relations_headers + superenddef rows@@ -205,7 +212,7 @@ module OpenProjecttype = relation_type work_package, other, relationdelay = relation ? relation.delay : ""description = relation ? relation.description : ""- relation_columns = ["", type, delay, description, other.id, other.type.name, other.subject]+ relation_columns = ["", type, delay, description] + column_values(other)[""] + wp_columns + relation_columnsend@@ -225,10 +232,7 @@ module OpenProject[Relation.human_attribute_name(:relation_type),Relation.human_attribute_name(:delay),- Relation.human_attribute_name(:description),- WorkPackage.human_attribute_name(:id),- WorkPackage.human_attribute_name(:type),- WorkPackage.human_attribute_name(:subject)+ Relation.human_attribute_name(:description)]enddiff --git a/modules/xls_export/spec/lib/work_package_xls_export_spec.rb b/modules/xls_export/spec/lib/work_package_xls_export_spec.rbindex bf0fbcb5e14..bac464f10b9 100644--- a/modules/xls_export/spec/lib/work_package_xls_export_spec.rb+++ b/modules/xls_export/spec/lib/work_package_xls_export_spec.rb@@ -93,11 +93,12 @@ describe "WorkPackageXlsExport" do# the first header row devides the sheet into work packages and relation columnsexpect(sheet.rows.first.take(8)).to eq ['Work packages', nil, nil, nil, nil, nil, nil, 'Relations']- # the second header row includes the column names for work packages and relations+ # the second header row includes the column names for work packages and relations and the related work packageexpect(sheet.rows[1]).to eq [nil, 'Type', 'ID', 'Subject', 'Status', 'Assignee', 'Priority',- nil, 'Relation type', 'Delay', 'Description', 'ID', 'Type', 'Subject',+ nil, 'Relation type', 'Delay', 'Description',+ 'Type', 'ID', 'Subject', 'Status', 'Assignee', 'Priority',nil]@@ -141,7 +142,8 @@ describe "WorkPackageXlsExport" doexpect(sheet.row(PARENT)).to eq [nil, parent.type.name, parent.id, parent.subject, parent.status.name, parent.assigned_to, parent.priority.name,- nil, 'parent of', nil, nil, child_1.id, child_1.type.name, child_1.subject+ nil, 'parent of', nil, nil,+ child_1.type.name, child_1.id, child_1.subject, child_1.status.name, child_1.assigned_to, child_1.priority.name] # delay nil as this is a parent-child relation not represented by an actual Relation recordexpect(sheet.row(SINGLE))@@ -151,9 +153,10 @@ describe "WorkPackageXlsExport" doexpect(sheet.row(FOLLOWED)).to eq [- nil, followed.type.name, followed.id, followed.subject, followed.status.name,- followed.assigned_to, followed.priority.name,- nil, 'Precedes', 0, relation.description, child_2.id, child_2.type.name, child_2.subject+ nil,+ followed.type.name, followed.id, followed.subject, followed.status.name, followed.assigned_to, followed.priority.name,+ nil, 'Precedes', 0, relation.description,+ child_2.type.name, child_2.id, child_2.subject, child_2.status.name, child_2.assigned_to, child_2.priority.name]end