Fix render visit summary sections in configured order#32
Open
BlessedAmrita wants to merge 1 commit into
Open
Conversation
|
3 tasks
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
The visit summary PDF ignored each section's configured order. Section order is stored as
report.visitSummary.section.<key>.orderand the renderer already emits sections into the intermediate XML sorted bygetOrder(), butvisitSummaryFopStylesheet.xslcalled each section's template from a hardcoded sequence, so the PDF always came out in that fixed order regardless of configuration. Enabling and disabling sections worked; reordering silently did nothing.The root template now walks the XML in document order (
<xsl:apply-templates select="*"/>), so the renderer's sort determines the PDF sequence. Each section's named template became a match template, which shortens its internal paths from document-root-relative to node-relative. Per-section output is unchanged. The footer is skipped in the body flow since it renders asfo:static-contenton every page.This surfaced now because the admin config page makes reordering possible for the first time.
Does this change existing PDFs?
No. With no order configured, each section's default order (facility header 100, patient info 200, vitals 300, diagnoses 400, conditions 450, lab results 475, allergies 500, medications 550, footer 900) produces the same sequence the hardcoded list did. Verified by transforming a default-ordered document through both the old and new stylesheet and diffing the FO output: byte identical, both for a fully populated document and one with empty sections plus
section-notice/section-errorsiblings.Related
Part of https://openmrs.atlassian.net/browse/O3-5667
Tests
130 passing, including 7 new: the pre-FOP XML sequence follows
getOrder()including scrambled configurations, disabled sections are omitted, FO output follows document order, section errors stay beside their section, and the footer renders once.