From 542aa482e110ea2ff1ba890e8af04cc2c1e4bc81 Mon Sep 17 00:00:00 2001
From: "a.schindlbeck" <a.schindlbeck@adito.de>
Date: Tue, 9 Jun 2020 15:27:50 +0200
Subject: [PATCH] #1057422 Notifications: onDBDelete uses
 notifications.deleteContentIfOrphan

---
 entity/Notification_entity/Notification_entity.aod           | 1 +
 entity/Notification_entity/recordcontainers/db/onDBDelete.js | 5 +++++
 2 files changed, 6 insertions(+)
 create mode 100644 entity/Notification_entity/recordcontainers/db/onDBDelete.js

diff --git a/entity/Notification_entity/Notification_entity.aod b/entity/Notification_entity/Notification_entity.aod
index 8c38d18bf1..296228bdb9 100644
--- a/entity/Notification_entity/Notification_entity.aod
+++ b/entity/Notification_entity/Notification_entity.aod
@@ -163,6 +163,7 @@
       <fromClauseProcess>%aditoprj%/entity/Notification_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess>
       <conditionProcess>%aditoprj%/entity/Notification_entity/recordcontainers/db/conditionProcess.js</conditionProcess>
       <orderClauseProcess>%aditoprj%/entity/Notification_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess>
+      <onDBDelete>%aditoprj%/entity/Notification_entity/recordcontainers/db/onDBDelete.js</onDBDelete>
       <linkInformation>
         <linkInformation>
           <name>c4e34b96-6081-4d04-8377-040a8ed3e14c</name>
diff --git a/entity/Notification_entity/recordcontainers/db/onDBDelete.js b/entity/Notification_entity/recordcontainers/db/onDBDelete.js
new file mode 100644
index 0000000000..05d1a30c0a
--- /dev/null
+++ b/entity/Notification_entity/recordcontainers/db/onDBDelete.js
@@ -0,0 +1,5 @@
+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
-- 
GitLab