Implementing Custom HFE-UI Print Functionality

In HtmlFormEntryUI, the Print Button functionality is currently hardcoded to use the browser print dialog (https://github.com/openmrs/openmrs-module-htmlformentryui/blob/c008d80ca04435d40d4d5abe59f3cd78a19b7801/omod/src/main/webapp/pages/htmlform/viewEncounterWithHtmlForm.gsp#L39).

It would be useful to allow supporting setting an alternative URL in the href by creating an ui.pageLink() and adding a link target attribute, from the gsp model, allowing other modules to provide another method of printing if needed.

One of the bigger questions that arises is how should that data be passed from another module to the ViewEncounter (https://github.com/openmrs/openmrs-module-htmlformentryui/blob/c008d80ca04435d40d4d5abe59f3cd78a19b7801/omod/src/main/java/org/openmrs/module/htmlformentryui/page/controller/htmlform/ViewEncounterWithHtmlFormPageController.java#L17-L49) controller?

Does this approach sound reasonable and would a Global Property or two be acceptable for this purpose?

@mogoodrich @mksd

A global property sounds reasonable to me @long27km… that seems like the simplest option and also seems “correct” because I think in the majority of cases an implementation will only have a single strategy for printing? (We could pass in a new RequestParam to “ViewEncounterWithHtmlFormPageController” but that would likely be overkill and needlessly complicated?)

Take care, Mark

Thanks, I’ll move forward with a Ticket and PR for this feature!