From a3799e75cdd6f60400f98fff7eecfe5563b4b679 Mon Sep 17 00:00:00 2001 From: gita cliff Date: Mon, 11 Mar 2019 16:39:03 +0300 Subject: [PATCH] DRM-28: Map Location Page Crashes when DHIS2 Instance has no ORG Units --- .../dhisreport/web/controller/LocationMappingController.java | 4 ++-- omod/src/main/webapp/mapLocations.jsp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/omod/src/main/java/org/openmrs/module/dhisreport/web/controller/LocationMappingController.java b/omod/src/main/java/org/openmrs/module/dhisreport/web/controller/LocationMappingController.java index babbc12..0b5fa7e 100644 --- a/omod/src/main/java/org/openmrs/module/dhisreport/web/controller/LocationMappingController.java +++ b/omod/src/main/java/org/openmrs/module/dhisreport/web/controller/LocationMappingController.java @@ -119,13 +119,13 @@ public void showConfigForm(ModelMap model, WebRequest webRequest) { @RequestMapping(value = "/module/dhisreport/mapLocations", method = RequestMethod.POST) public String mapLocations(ModelMap model, - @RequestParam(value = "DHIS2OrgUnits", required = true) String dhis2OrgUnitCode, + @RequestParam(value = "DHIS2OrgUnits", required = false) String dhis2OrgUnitCode, @RequestParam(value = "openmrsLocations", required = true) String openmrsLocationName, WebRequest webRequest) { System.out.println("org unit does not exits and it is : " + dhis2OrgUnitCode); String referer = webRequest.getHeader("Referer"); - if (dhis2OrgUnitCode.equals("")) { + if (dhis2OrgUnitCode == null || dhis2OrgUnitCode.isEmpty()) { System.out.println("org unit does not exits"); webRequest.setAttribute(WebConstants.OPENMRS_MSG_ATTR, Context.getMessageSourceService().getMessage("dhisreport.orgUnitCodeDoesNotExist"), diff --git a/omod/src/main/webapp/mapLocations.jsp b/omod/src/main/webapp/mapLocations.jsp index c26d1c5..b8d4815 100644 --- a/omod/src/main/webapp/mapLocations.jsp +++ b/omod/src/main/webapp/mapLocations.jsp @@ -37,7 +37,7 @@ - +