From 5325b61e18943dc1c9338d7a249a5332876c3c43 Mon Sep 17 00:00:00 2001 From: Mark Goodrich Date: Fri, 23 Feb 2024 17:08:19 -0500 Subject: [PATCH] HTML-838: Create GP to control default for hiding seconds with the Time Widget --- .../openmrs/module/htmlformentry/HtmlFormEntryConstants.java | 2 ++ .../org/openmrs/module/htmlformentry/widget/TimeWidget.java | 5 +++-- omod/src/main/resources/config.xml | 5 +++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/api/src/main/java/org/openmrs/module/htmlformentry/HtmlFormEntryConstants.java b/api/src/main/java/org/openmrs/module/htmlformentry/HtmlFormEntryConstants.java index 339e64db7..677e1558a 100644 --- a/api/src/main/java/org/openmrs/module/htmlformentry/HtmlFormEntryConstants.java +++ b/api/src/main/java/org/openmrs/module/htmlformentry/HtmlFormEntryConstants.java @@ -36,6 +36,8 @@ public class HtmlFormEntryConstants { public static final String GP_RESTRICT_ENCOUNTER_LOCATION_TO_CURRENT_VISIT_LOCATION = "htmlformentry.restrictEncounterLocationToCurrentVisitLocation"; + public static final String GP_TIME_WIDGET_HIDE_SECONDS_DEFAULT = "htmlformenty.timeWidgetHideSecondsDefault"; + public final static String GP_TIMEZONE_CONVERSIONS = "timezone.conversions"; public static final String COMPLEX_UUID = "8d4a6242-c2cc-11de-8d13-0010c6dffd0f"; diff --git a/api/src/main/java/org/openmrs/module/htmlformentry/widget/TimeWidget.java b/api/src/main/java/org/openmrs/module/htmlformentry/widget/TimeWidget.java index c861e625f..a825cb313 100644 --- a/api/src/main/java/org/openmrs/module/htmlformentry/widget/TimeWidget.java +++ b/api/src/main/java/org/openmrs/module/htmlformentry/widget/TimeWidget.java @@ -25,12 +25,13 @@ public class TimeWidget implements Widget { private boolean hidden; - private boolean hideSeconds = false; + private boolean hideSeconds; private String timeFormat; public TimeWidget() { - + hideSeconds = "true".equalsIgnoreCase(Context.getAdministrationService() + .getGlobalProperty(HtmlFormEntryConstants.GP_TIME_WIDGET_HIDE_SECONDS_DEFAULT, "false")); } private SimpleDateFormat timeFormat() { diff --git a/omod/src/main/resources/config.xml b/omod/src/main/resources/config.xml index 678e0a88d..968ea5fcb 100644 --- a/omod/src/main/resources/config.xml +++ b/omod/src/main/resources/config.xml @@ -97,6 +97,11 @@ false When set to true and an encounter is being entered in the context of a visit, the encounter location will be restricted to the current visit location (and it's descendents) + + htmlformenty.timeWidgetHideSecondsDefault + false + When rendering the time widget, whether to hide the seconds widget by default + //TODO this GP should be removed once the timezone.conversions GP is provided by Core.