Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,16 @@ public abstract class AbstractSampleForm extends AbstractEditForm<SampleDto> {
fluidRowLocs(CaseDataDto.OTHER_DELETION_REASON);
//@formatter:on

private Disease disease;

protected AbstractSampleForm(Class<SampleDto> type, String propertyI18nPrefix, Disease disease, UiFieldAccessCheckers fieldAccessCheckers) {
super(
type,
propertyI18nPrefix,
true,
FieldVisibilityCheckers.withDisease(disease).andWithCountry(FacadeProvider.getConfigFacade().getCountryLocale()),
fieldAccessCheckers);
this.disease = disease;
}

protected void addCommonFields() {
Expand Down Expand Up @@ -456,4 +459,9 @@ private void updateRequestedTestFields() {
getContent().removeComponent(REQUESTED_ADDITIONAL_TESTS_READ_LOC);
}
}


public Disease getDisease() {
return disease;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
public class SampleController {

private Disease disease;

public SampleController() {
}

Expand Down Expand Up @@ -212,7 +213,10 @@ private CollapsiblePathogenTestForm addPathogenTestComponent(
separator.setVisible(addSeparator);
sampleComponent.addComponent(separator, sampleComponent.getComponentCount() - 1);

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
final Disease pathogenTestFormDisease = disease != null ? disease : sampleComponent.getWrappedComponent().getDisease();

PathogenTestForm pathogenTestForm =
new PathogenTestForm(sampleComponent.getWrappedComponent(), true, caseSampleCount, false, true, pathogenTestFormDisease); // Valid because jurisdiction doesn't matter for entities that are about to be created
// prefill fields
if (pathogenTest != null) {
pathogenTestForm.setValue(pathogenTest);
Expand All @@ -228,8 +232,7 @@ private CollapsiblePathogenTestForm addPathogenTestComponent(
pathogenTestResultField.setValue(PathogenTestResultType.PENDING);
ComboBox testDiseaseField = pathogenTestForm.getField(PathogenTestDto.TESTED_DISEASE);
// setting the disease field value is only necessary if the disease is not null
testDiseaseField.setValue(disease);

testDiseaseField.setValue(pathogenTestFormDisease);
}
// setup field updates
Field testLabField = pathogenTestForm.getField(PathogenTestDto.LAB);
Expand Down
Loading