diff --git a/entity/Appointment_entity/recordcontainers/jdito/onDelete.js b/entity/Appointment_entity/recordcontainers/jdito/onDelete.js index 80fb7869b5f59190558797549e7717b73da53db4..7abca1e85cd72262cbcde93854d041f1a6956211 100644 --- a/entity/Appointment_entity/recordcontainers/jdito/onDelete.js +++ b/entity/Appointment_entity/recordcontainers/jdito/onDelete.js @@ -1,6 +1,8 @@ +import("Sql_lib"); import("system.neon"); import("system.calendars"); import("system.vars"); +import("system.db"); if (vars.exists("$param.Entry_param")) @@ -10,4 +12,14 @@ if (vars.exists("$param.Entry_param")) if (reccurenceid == undefined) reccurenceid = null; calendars.removeEntryByUID(calendars.VEVENT, vars.get("$sys.user"), entry[calendars.ID], reccurenceid) + + + /** + * Deletes ApointmentLinks referring to the deleted Appointment. + */ + var cond = SqlCondition.begin(); + cond.andPrepareValue("AB_APPOINTMENTLINK.APPOINTMENT_ID", entry[calendars.ID]) + var idscond = db.translateCondition(cond.build("1 = 2")); + + db.deleteData("AB_APPOINTMENTLINK", idscond); } \ No newline at end of file