From 449f3ade06687e754170538490a7c97cc40e6021 Mon Sep 17 00:00:00 2001 From: Dorian Nemec Date: Tue, 21 May 2024 10:38:04 +0200 Subject: [PATCH] #24 Bugfix --- .../java/de/hitec/nhplus/nurse/LockedNurseController.java | 5 +++++ .../de/hitec/nhplus/treatment/database/Treatment.sql | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/hitec/nhplus/nurse/LockedNurseController.java b/src/main/java/de/hitec/nhplus/nurse/LockedNurseController.java index f601b1b..0f1d932 100644 --- a/src/main/java/de/hitec/nhplus/nurse/LockedNurseController.java +++ b/src/main/java/de/hitec/nhplus/nurse/LockedNurseController.java @@ -113,6 +113,11 @@ public class LockedNurseController { @FXML public void handleMouseClick() { Nurse nurse = tableView.getSelectionModel().getSelectedItem(); + if(nurse == null) + { + return; + } + boolean canBeDeleted = nurse.calculateDeleteDate().isBefore(LocalDate.now()); buttonDelete.setDisable(!canBeDeleted); } diff --git a/src/main/resources/de/hitec/nhplus/treatment/database/Treatment.sql b/src/main/resources/de/hitec/nhplus/treatment/database/Treatment.sql index d05436c..2af0104 100644 --- a/src/main/resources/de/hitec/nhplus/treatment/database/Treatment.sql +++ b/src/main/resources/de/hitec/nhplus/treatment/database/Treatment.sql @@ -10,5 +10,5 @@ CREATE TABLE treatment remark TEXT NOT NULL, isLocked BOOLEAN NOT NULL DEFAULT false, FOREIGN KEY (patientId) REFERENCES patient (id) ON DELETE CASCADE, - FOREIGN KEY (nurseId) REFERENCES nurse (id) ON DELETE SET NULL + FOREIGN KEY (nurseId) REFERENCES nurse (id) ON DELETE CASCADE ) \ No newline at end of file