From 9499895ac24a694b3cf4aa38b732cf459ff09a3b Mon Sep 17 00:00:00 2001 From: Pedro Sousa - ICRC <68599335+icrc-psousa@users.noreply.github.com> Date: Wed, 11 Dec 2024 18:44:29 +0000 Subject: [PATCH] RESTWS-962: Return empty result when the specified encounter type is not found --- .../web/v1_0/search/openmrs2_0/EncounterSearchHandler2_0.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/search/openmrs2_0/EncounterSearchHandler2_0.java b/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/search/openmrs2_0/EncounterSearchHandler2_0.java index 5ea5f84a8..727e1b915 100644 --- a/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/search/openmrs2_0/EncounterSearchHandler2_0.java +++ b/omod-2.0/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/search/openmrs2_0/EncounterSearchHandler2_0.java @@ -73,7 +73,7 @@ public PageableResult search(RequestContext context) throws ResponseException { EncounterType encounterType = ((EncounterTypeResource1_8) Context.getService(RestService.class) .getResourceBySupportedClass(EncounterType.class)).getByUniqueId(encounterTypeUuid); - if (patient != null) { + if (patient != null && (encounterType != null || encounterTypeUuid == null)) { EncounterSearchCriteriaBuilder encounterSearchCriteriaBuilder = new EncounterSearchCriteriaBuilder() .setPatient(patient).setFromDate(fromDate).setToDate(toDate).setIncludeVoided(false); if (encounterType != null) {