Skip to content
Merged
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 @@ -343,13 +343,24 @@ private void openEditWindow(CaseDataDto caze, NotifierDto notifier, String title
* the form containing the values
*/
private void updateSurveillanceReportFromForm(SurveillanceReportDto surveillanceReport, CaseNotifierForm notifierForm) {
// Update report date from notification date
final LocalDate notificationDate = notifierForm.getNotificationDate();
surveillanceReport.setReportDate(Date.from(notificationDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));

// Update report date from notification date if provided
if (notifierForm.getNotificationDate() != null) {
surveillanceReport.setReportDate(Date.from(notifierForm.getNotificationDate().atStartOfDay(ZoneId.systemDefault()).toInstant()));
} else {
// if no notification date is provided, use the current date as long as the report date is not set
if (surveillanceReport.getReportDate() == null) {
surveillanceReport.setReportDate(new Date());
}
}

// Update diagnosis date if provided
final LocalDate diagnosticDate = notifierForm.getDiagnosticDate();
surveillanceReport.setDateOfDiagnosis(Date.from(diagnosticDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
if (diagnosticDate != null) {
surveillanceReport.setDateOfDiagnosis(Date.from(diagnosticDate.atStartOfDay(ZoneId.systemDefault()).toInstant()));
} else {
surveillanceReport.setDateOfDiagnosis(null);
}

// Update treatment based on selected option
final TreatmentOption selectedOption = notifierForm.getSelectedTreatmentOption();
Expand Down
Loading