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
pdf export: hide project phase attribute if there is no project phase active in the project
as-op061744728683
diff --git a/app/models/work_package/exports/attributes.rb b/app/models/work_package/exports/attributes.rbindex 08497bfe4d9..48f442063d2 100644--- a/app/models/work_package/exports/attributes.rb+++ b/app/models/work_package/exports/attributes.rb@@ -27,9 +27,14 @@#++module WorkPackage::Exportsmodule Attributes- def user_allowed_in_view_attribute?(obj, attribute_name)+ def user_allowed_view_wp_project_phase?(work_package)+ User.current.allowed_in_project?(:view_project_phases, work_package.project) &&+ work_package.project.phases.active.any?+ end++ def user_allowed_view_attribute?(obj, attribute_name)if attribute_name.to_sym == :project_phase && obj.is_a?(WorkPackage)- User.current.allowed_in_project?(:view_project_phases, obj.project)+ user_allowed_view_wp_project_phase?(obj)elsetrueenddiff --git a/app/models/work_package/exports/macros/attributes.rb b/app/models/work_package/exports/macros/attributes.rbindex 2d4b0d4d67c..f68eaccdcfa 100644--- a/app/models/work_package/exports/macros/attributes.rb+++ b/app/models/work_package/exports/macros/attributes.rb@@ -156,7 +156,7 @@ module WorkPackage::Exports"cf_#{cf.id}"end- return "" if cf.nil? && !user_allowed_in_view_attribute?(obj, ar_name)+ return "" if cf.nil? && !user_allowed_view_attribute?(obj, ar_name)return msg_macro_error_rich_text if disabled_rich_text_fields.include?(ar_name.to_sym)format_attribute_value(ar_name, obj.class, obj)diff --git a/app/models/work_package/pdf_export/export/wp/attributes.rb b/app/models/work_package/pdf_export/export/wp/attributes.rbindex 445b4eb7961..86d0f4887b4 100644--- a/app/models/work_package/pdf_export/export/wp/attributes.rb+++ b/app/models/work_package/pdf_export/export/wp/attributes.rb@@ -140,7 +140,7 @@ module WorkPackage::PDFExport::Export::Wp::Attributescurrent_part = { type: :attribute, list: [] }parts = [current_part]group.attributes.each do |form_key|- if !CustomField.custom_field_attribute?(form_key) && !user_allowed_in_view_attribute?(work_package, form_key)+ if !CustomField.custom_field_attribute?(form_key) && !user_allowed_view_attribute?(work_package, form_key)nextend