Skip to content

Commit

Permalink
RESTWS-923: Filter out retired forms in /forms endpoint (#592)
Browse files Browse the repository at this point in the history
* RESTWS-923: Filter out retired forms in /forms endpoint

* RESTWS-923: Filter out retired forms in /forms endpoint - Using context.getIncludeAll for when retired forms are to  be included in response

---------

Co-authored-by: Amos Laboso <[email protected]>
  • Loading branch information
alaboso and Amos Laboso authored Nov 2, 2023
1 parent 824b382 commit 71d07f0
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
import io.swagger.models.properties.IntegerProperty;
import io.swagger.models.properties.RefProperty;
import io.swagger.models.properties.StringProperty;
import org.openmrs.EncounterType;
import org.openmrs.Field;
import org.openmrs.Form;
import org.openmrs.FormField;
import org.openmrs.api.context.Context;
import org.openmrs.module.webservices.rest.web.RequestContext;
import org.openmrs.module.webservices.rest.web.RestConstants;
Expand Down Expand Up @@ -194,7 +197,11 @@ protected NeedsPaging<Form> doGetAll(RequestContext context) throws ResponseExce
*/
@Override
protected NeedsPaging<Form> doSearch(RequestContext context) {
return new NeedsPaging<Form>(Context.getFormService().getForms(context.getParameter("q"), false), context);
String fuzzyName = context.getParameter("q");
boolean includeRetired = context.getIncludeAll();

return new NeedsPaging<Form>(Context.getFormService().getForms(fuzzyName, null, null,
includeRetired, null, null, null), context);
}

/**
Expand Down

0 comments on commit 71d07f0

Please sign in to comment.