Adapt timesheet PDF export for semantic work package identifiers

The work package column hardcoded the numeric id. Using formatted_id
renders the project-based identifier in semantic mode.
This commit is contained in:
Kabiru Mwenja
2026-06-12 14:15:23 +03:00
parent af3a6323de
commit 375dcaba05
2 changed files with 13 additions and 1 deletions
@@ -224,7 +224,7 @@ class CostQuery::PDF::TimesheetGenerator
href = url_helpers.work_package_url(entry.entity) href = url_helpers.work_package_url(entry.entity)
{ {
content: "#{make_link_href(href, "##{entry.entity.id}")} #{entry.entity.subject || ''}", content: "#{make_link_href(href, entry.entity.formatted_id)} #{entry.entity.subject || ''}",
inline_format: true inline_format: true
} }
end end
@@ -227,4 +227,16 @@ RSpec.describe CostQuery::PDF::TimesheetGenerator do
expect(subject).to eq expected_document(false) expect(subject).to eq expected_document(false)
end end
end end
context "with semantic work package identifiers",
with_settings: { work_packages_identifier: "semantic", allow_tracking_start_and_end_times: false } do
before do
user_time_entry.entity.update_columns(identifier: "PROD-42", sequence_number: 42)
end
it "renders the semantic identifier in the work package column" do
expect(subject).to include("PROD-42")
expect(subject).not_to include("##{user_time_entry.entity.id}")
end
end
end end