diff --git a/api/src/main/java/org/openmrs/module/pihcore/apploader/apps/patientregistration/SectionsLiberia.java b/api/src/main/java/org/openmrs/module/pihcore/apploader/apps/patientregistration/SectionsLiberia.java index c6916354c..be8ca472f 100644 --- a/api/src/main/java/org/openmrs/module/pihcore/apploader/apps/patientregistration/SectionsLiberia.java +++ b/api/src/main/java/org/openmrs/module/pihcore/apploader/apps/patientregistration/SectionsLiberia.java @@ -2,6 +2,8 @@ import org.openmrs.module.pihcore.config.Components; import org.openmrs.module.pihcore.config.Config; +import org.openmrs.module.pihcore.metadata.Metadata; +import org.openmrs.module.registrationapp.model.CheckboxWidget; import org.openmrs.module.registrationapp.model.DropdownWidget; import org.openmrs.module.registrationapp.model.Field; import org.openmrs.module.registrationapp.model.Question; @@ -34,6 +36,33 @@ public void addSections(RegistrationAppConfig c) { } } + @Override + public Section getContactInfoSection() { + // build the default contact info section and retrieve the address question + Section contactInfoSection = super.getContactInfoSection(); + + Question homelessQuestion = new Question(); + homelessQuestion.setHeader("pihcore.homeless"); + homelessQuestion.setLegend("pihcore.homeless"); + + // add the homeless section to it. + Field field = new Field(); + field.setFormFieldName("homeless"); + field.setType("personAttribute"); + field.setLabel("pihcore.homeless"); + field.setUuid(Metadata.getHomelessAttributeType().getUuid()); + + CheckboxWidget w = new CheckboxWidget(); + w.getConfig().setValue("true"); + field.setWidget(toObjectNode(w)); + homelessQuestion.addField(field); + + // insert after the "address" question (assumption: address is first question) + contactInfoSection.getQuestions().add(1, homelessQuestion); + + return contactInfoSection; + } + @Override public Section getSocialSection() { Section s = new Section(); diff --git a/api/src/main/java/org/openmrs/module/pihcore/metadata/Metadata.java b/api/src/main/java/org/openmrs/module/pihcore/metadata/Metadata.java index 74f074e37..dcdf62e41 100644 --- a/api/src/main/java/org/openmrs/module/pihcore/metadata/Metadata.java +++ b/api/src/main/java/org/openmrs/module/pihcore/metadata/Metadata.java @@ -45,6 +45,10 @@ public static PersonAttributeType getUnknownPatientAttributeType() { return Context.getPersonService().getPersonAttributeTypeByUuid(PihEmrConfigConstants.PERSONATTRIBUTETYPE_UNKNOWN_PATIENT_UUID); } + public static PersonAttributeType getHomelessAttributeType() { + return Context.getPersonService().getPersonAttributeTypeByUuid(PihEmrConfigConstants.PERSONATTRIBUTETYPE_HOMELESS_UUID); + } + public static PatientIdentifierType getNifIdentifierType() { return Context.getPatientService().getPatientIdentifierTypeByUuid(ZlConfigConstants.PATIENTIDENTIFIERTYPE_NIF_UUID); } diff --git a/pom.xml b/pom.xml index 99724490b..74cf4591f 100644 --- a/pom.xml +++ b/pom.xml @@ -86,7 +86,7 @@ 1.5.0-SNAPSHOT 2.14.0 1.6.0-SNAPSHOT - 1.25.0 + 1.26.0-SNAPSHOT 1.12.0 1.26.0-SNAPSHOT 1.14.0 @@ -94,7 +94,7 @@ 0.2.16 1.0.9 1.7.0 - 2.23.0 + 2.24.0-SNAPSHOT 3.24.0-SNAPSHOT 2.0.7 2.37.0-SNAPSHOT