From 17f5d5092c4303818739530566c8d005253c6b74 Mon Sep 17 00:00:00 2001
From: "a.schindlbeck" <a.schindlbeck@adito.de>
Date: Tue, 4 Aug 2020 14:35:00 +0200
Subject: [PATCH] #1063130 Notifications: Appointment-contents won't be deleted
 when orphan, because they would appear again as a notification

---
 .../Notification_entity/recordcontainers/db/onDBDelete.js   | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/entity/Notification_entity/recordcontainers/db/onDBDelete.js b/entity/Notification_entity/recordcontainers/db/onDBDelete.js
index 05d1a30c0a..54618e0f77 100644
--- a/entity/Notification_entity/recordcontainers/db/onDBDelete.js
+++ b/entity/Notification_entity/recordcontainers/db/onDBDelete.js
@@ -1,5 +1,7 @@
 import("system.vars");
 import("system.notification");
 
-// Deletes notificationContents from its table, if there are no
-notification.deleteContentIfOrphan(vars.get("$field.ID"), vars.get("$field.CONTENTID"));
\ No newline at end of file
+// Deletes notificationContents from its table, if there are no user notification left
+// Only AppointmentContents need to stay, because they would appear again after every deletion.
+if(vars.get("$field.TYPECODE") != "_____SYSTEM_NOTIFICATION_APPOINTMENT")
+    notification.deleteContentIfOrphan(vars.get("$field.ID"), vars.get("$field.CONTENTID"));
\ No newline at end of file
-- 
GitLab