From ff687263cee01615de2d088ed5b17a3f0be5f4d1 Mon Sep 17 00:00:00 2001 From: "j.goderbauer" <j.goderbauer@adito.de> Date: Thu, 30 Jan 2020 11:01:24 +0100 Subject: [PATCH] GDPR: Workaround for loading by idvalues (e.g. on "Save and Open") --- .../recordcontainers/jdito/contentProcess.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/entity/DSGVO_entity/recordcontainers/jdito/contentProcess.js b/entity/DSGVO_entity/recordcontainers/jdito/contentProcess.js index be1eae350e9..488dd2cdd88 100644 --- a/entity/DSGVO_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/DSGVO_entity/recordcontainers/jdito/contentProcess.js @@ -16,6 +16,20 @@ var filterCond; if (vars.exists("$local.idvalues") && vars.get("$local.idvalues") && vars.get("$local.idvalues").length > 0) { filterCond = newWhere("DSGVO.DSGVOID", vars.get("$local.idvalues"), SqlBuilder.IN()); + //this is a workaround: when using $local.idvalues the contactId-param may not be set. + //But the DataPrivacyUtils.collectAll function needs a contactId to work properly, and there exists no other function to load the data by uids + //when the upper TODO is done, this workaround can be removed + if (contactId == null) + { + var contactIds = (new SqlBuilder()).selectDistinct("DSGVO.CONTACT_ID") + .from("DSGVO") + .where(filterCond) + .arrayColumn(); + if (contactIds.length > 1) + throw new Error("DSGVO_entity.jdito.contentProcess: tried to load data for more than one contact; this is not implemented"); + + contactId = contactIds[0]; + } } var data = DataPrivacyUtils.collectAll(contactId, filterCond) -- GitLab