Skip to content

Commit bd57f94

Browse files
authored
Merge pull request #13746 from SORMAS-Foundation/bugfix-13742-igra_values_not_visible_lab_message
#13742 - Fixed missing disease in Sample/PathogenTest form
2 parents 07eec30 + 748882b commit bd57f94

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,16 @@ public abstract class AbstractSampleForm extends AbstractEditForm<SampleDto> {
111111
fluidRowLocs(CaseDataDto.OTHER_DELETION_REASON);
112112
//@formatter:on
113113

114+
private Disease disease;
115+
114116
protected AbstractSampleForm(Class<SampleDto> type, String propertyI18nPrefix, Disease disease, UiFieldAccessCheckers fieldAccessCheckers) {
115117
super(
116118
type,
117119
propertyI18nPrefix,
118120
true,
119121
FieldVisibilityCheckers.withDisease(disease).andWithCountry(FacadeProvider.getConfigFacade().getCountryLocale()),
120122
fieldAccessCheckers);
123+
this.disease = disease;
121124
}
122125

123126
protected void addCommonFields() {
@@ -456,4 +459,9 @@ private void updateRequestedTestFields() {
456459
getContent().removeComponent(REQUESTED_ADDITIONAL_TESTS_READ_LOC);
457460
}
458461
}
462+
463+
464+
public Disease getDisease() {
465+
return disease;
466+
}
459467
}

sormas-ui/src/main/java/de/symeda/sormas/ui/samples/humansample/SampleController.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@
100100
public class SampleController {
101101

102102
private Disease disease;
103+
103104
public SampleController() {
104105
}
105106

@@ -212,7 +213,10 @@ private CollapsiblePathogenTestForm addPathogenTestComponent(
212213
separator.setVisible(addSeparator);
213214
sampleComponent.addComponent(separator, sampleComponent.getComponentCount() - 1);
214215

215-
PathogenTestForm pathogenTestForm = new PathogenTestForm(sampleComponent.getWrappedComponent(), true, caseSampleCount, false, true, disease); // Valid because jurisdiction doesn't matter for entities that are about to be created
216+
final Disease pathogenTestFormDisease = disease != null ? disease : sampleComponent.getWrappedComponent().getDisease();
217+
218+
PathogenTestForm pathogenTestForm =
219+
new PathogenTestForm(sampleComponent.getWrappedComponent(), true, caseSampleCount, false, true, pathogenTestFormDisease); // Valid because jurisdiction doesn't matter for entities that are about to be created
216220
// prefill fields
217221
if (pathogenTest != null) {
218222
pathogenTestForm.setValue(pathogenTest);
@@ -228,8 +232,7 @@ private CollapsiblePathogenTestForm addPathogenTestComponent(
228232
pathogenTestResultField.setValue(PathogenTestResultType.PENDING);
229233
ComboBox testDiseaseField = pathogenTestForm.getField(PathogenTestDto.TESTED_DISEASE);
230234
// setting the disease field value is only necessary if the disease is not null
231-
testDiseaseField.setValue(disease);
232-
235+
testDiseaseField.setValue(pathogenTestFormDisease);
233236
}
234237
// setup field updates
235238
Field testLabField = pathogenTestForm.getField(PathogenTestDto.LAB);

0 commit comments

Comments
 (0)