From a437b00921682e2f1c3eaf1b4b7053d8fb29c3d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20S=C3=A4ume?= Date: Wed, 22 May 2024 18:56:08 +0200 Subject: [PATCH] NOTICKET: Bugfix for Treatment locking MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Dominik Säume --- .../hitec/nhplus/treatment/AllTreatmentController.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/de/hitec/nhplus/treatment/AllTreatmentController.java b/src/main/java/de/hitec/nhplus/treatment/AllTreatmentController.java index ec8a4a9..f293f50 100644 --- a/src/main/java/de/hitec/nhplus/treatment/AllTreatmentController.java +++ b/src/main/java/de/hitec/nhplus/treatment/AllTreatmentController.java @@ -312,6 +312,8 @@ public class AllTreatmentController { @FXML public void handleLock(){ Treatment selectedItem = this.tableView.getSelectionModel().getSelectedItem(); + LocalDate today = LocalDate.now(); + if (selectedItem == null){ return; } @@ -322,6 +324,13 @@ public class AllTreatmentController { }catch (SQLException exception){ exception.printStackTrace(); } + if (selectedItem.calculateDeleteDate().isBefore(today) || selectedItem.calculateDeleteDate().equals(today)){ + try { + dao.delete(selectedItem.getId()); + } catch (SQLException e) { + throw new RuntimeException(e); + } + } readAllAndShowInTableView(); }