Skip to content

Commit 4e078c5

Browse files
committed
Fixed call order to updateDrugSusceptibilityFields and modified DrugSusceptibilityForm
- for DrugSusceptibilityForm, added a conditional exit to prevent enabling susceptility contents if country is not Luxembourg - In PathogenTestForm, moved the call to updateDrugSusceptibilityFields to the end of the listener chain
1 parent 7c70253 commit 4e078c5

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

sormas-ui/src/main/java/de/symeda/sormas/ui/samples/PathogenTestForm.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,11 +1175,14 @@ protected void addFields() {
11751175

11761176
if (RESULT_FIELD_DECISION_MAP.containsKey(disease) && RESULT_FIELD_DECISION_MAP.get(disease).contains(testType)) {
11771177
testResultField.setValue(PathogenTestResultType.POSITIVE);
1178-
testResultField.setReadOnly(testResultFieldReadOnly);
1178+
testResultField.setEnabled(false);
11791179
} else {
11801180
testResultField.clear();
11811181
testResultField.setEnabled(true);
11821182
}
1183+
1184+
testResultField.setReadOnly(testResultFieldReadOnly);
1185+
updateDrugSusceptibilityFieldSpecifications(testType, (Disease) diseaseField.getValue());
11831186
};
11841187

11851188
testTypeField.addValueChangeListener(e -> {
@@ -1193,8 +1196,6 @@ protected void addFields() {
11931196
fourFoldIncrease.setEnabled(false);
11941197
}
11951198

1196-
updateDrugSusceptibilityFieldSpecifications(testType, (Disease) diseaseField.getValue());
1197-
11981199
if (diseaseField.getValue() == null || !List.of(Disease.TUBERCULOSIS).contains((Disease) diseaseField.getValue())) {
11991200
setVisibleClear(
12001201
PathogenTestType.PCR_RT_PCR == testType,

sormas-ui/src/main/java/de/symeda/sormas/ui/therapy/DrugSusceptibilityForm.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
import com.vaadin.v7.ui.ComboBox;
3232
import com.vaadin.v7.ui.TextField;
3333

34+
import de.symeda.sormas.api.CountryHelper;
3435
import de.symeda.sormas.api.Disease;
36+
import de.symeda.sormas.api.FacadeProvider;
3537
import de.symeda.sormas.api.i18n.I18nProperties;
3638
import de.symeda.sormas.api.i18n.Strings;
3739
import de.symeda.sormas.api.sample.PathogenTestType;
@@ -297,6 +299,12 @@ private void forceUpdateDrugSusceptibilityMicField(String fieldId, Optional<Floa
297299

298300
public void updateFieldsVisibility(Disease disease, PathogenTestType pathogenTestType) {
299301
FieldHelper.hideFieldsNotInList(getFieldGroup(), List.of(), true);
302+
formHeadingLabel.setVisible(false);
303+
304+
// Drug susceptibility fields are hidden for other countries than Luxembourg
305+
if(!FacadeProvider.getConfigFacade().isConfiguredCountry(CountryHelper.COUNTRY_CODE_LUXEMBOURG)) {
306+
return;
307+
}
300308

301309
if (disease != null && pathogenTestType != null) {
302310
List<String> applicableFieldIds =

0 commit comments

Comments
 (0)