diff --git a/entity/DSGVO_entity/recordcontainers/jdito/contentProcess.js b/entity/DSGVO_entity/recordcontainers/jdito/contentProcess.js index be1eae350e9c4115306985baf9d0d7ac6429c534..488dd2cdd887a32c566fd853d2c3ae3cf87a27a9 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)