Skip to content

Commit 11bf73b

Browse files
authored
Merge pull request #13699 from SORMAS-Foundation/bugfix-13685-phone_notification_validations
#13685 - Fixed notification form closing regardless of validation
2 parents 41cf88a + bec2a3d commit 11bf73b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

sormas-ui/src/main/java/de/symeda/sormas/ui/caze/notifier/CaseNotifierSideViewController.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,7 @@ public void editNotifier(CaseDataDto caze, Runnable callback, boolean isEditAllo
145145
}
146146

147147
// We only edit the current version
148-
NotifierDto notifier =
149-
FacadeProvider.getNotifierFacade().getByUuid(caze.getNotifier().getUuid());
148+
NotifierDto notifier = FacadeProvider.getNotifierFacade().getByUuid(caze.getNotifier().getUuid());
150149
TherapyDto therapy = caze.getTherapy();
151150

152151
openEditWindow(
@@ -207,13 +206,21 @@ private void openEditWindow(
207206
final Window window = VaadinUiUtil.showModalPopupWindow(editView, title);
208207

209208
if (isEditAllowed) {
209+
editView.setPreCommitListener((cb) -> {
210+
if (!notifierForm.isValid()) {
211+
// Form validation failed - errors are already shown on the form
212+
return;
213+
}
214+
cb.run();
215+
});
210216
editView.addCommitListener(() -> {
211217
if (notifierForm.isValid()) {
212218
NotifierDto savedNotifier = notifierForm.getValue();
213219
savedNotifier = FacadeProvider.getNotifierFacade().save(savedNotifier);
214220

215221
// always set the notifier reference on the case to the current version
216-
final NotifierReferenceDto notifierRef = FacadeProvider.getNotifierFacade().getVersionReferenceByUuidAndDate(savedNotifier.getUuid());
222+
final NotifierReferenceDto notifierRef =
223+
FacadeProvider.getNotifierFacade().getVersionReferenceByUuidAndDate(savedNotifier.getUuid());
217224
caze.setNotifier(notifierRef);
218225

219226
// Handle treatment option changes

0 commit comments

Comments
 (0)