diff --git a/entity/DSGVOInfo_entity/DSGVOInfo_entity.aod b/entity/DSGVOInfo_entity/DSGVOInfo_entity.aod index 521b975ab3cdb584d67251eea8b52dd24428175c..6c5411ae692c28229230f24859149f2992934710 100644 --- a/entity/DSGVOInfo_entity/DSGVOInfo_entity.aod +++ b/entity/DSGVOInfo_entity/DSGVOInfo_entity.aod @@ -2,6 +2,7 @@ <entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.9" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.9"> <name>DSGVOInfo_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> + <onValidation>%aditoprj%/entity/DSGVOInfo_entity/onValidation.js</onValidation> <recordContainer>db</recordContainer> <entityFields> <entityProvider> diff --git a/entity/DSGVOInfo_entity/onValidation.js b/entity/DSGVOInfo_entity/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..040a475518cd036bd2b9137060bf01040accfd6e --- /dev/null +++ b/entity/DSGVOInfo_entity/onValidation.js @@ -0,0 +1,9 @@ +import("system.vars"); +import("system.translate"); +import("system.result"); +import("DataPrivacy_lib"); + +if (!DataPrivacyUtils.checkAllFilled(vars.get("$field.CONTACT_ID"))) +{ + result.string(translate.text("Not all data privacy fields for all private data is filled. Cannot create report.")) +} \ No newline at end of file diff --git a/process/DataPrivacy_lib/process.js b/process/DataPrivacy_lib/process.js index e75134b1d64e70e42f83aad397e9768fc51890cb..8c485326b4dc18f5c55227335953ed22b1d33ca8 100644 --- a/process/DataPrivacy_lib/process.js +++ b/process/DataPrivacy_lib/process.js @@ -3,7 +3,6 @@ import("PostalAddress_lib"); import("system.text"); import("system.question"); import("Attribute_lib"); -import("system.logging"); import("Keyword_lib") import("KeywordRegistry_basic"); import("system.translate"); @@ -77,7 +76,6 @@ DataPrivacyType.get = function(pKey) .provider("Contact") .uid(pContactId) .fields(fields); - logging.log(entityConfig.toString()); return entities.getRow(entityConfig); } @@ -384,13 +382,23 @@ DataPrivacyUtils.informationReport = function(pContactId, pLocale) } -//////////////////////////////////////////////////////////////////////// -// Deprecated functions: - DataPrivacyUtils.DisclosureReportName = function() { return "DSGVO_Disclosure_report"; } +/** + * Note: this function requires that all fields in the DSGVO table are updated (via DataPrivacyUtils.collectAll()) + * Otherwise there may be fields in DSGVO which do not exist anymore in the person or some are missing. + */ +DataPrivacyUtils.checkAllFilled = function(pContactId) +{ + var countNotFilled = db.cell(SqlCondition.begin() + .andPrepare("DSGVO.CONTACT_ID", pContactId) + .and("STATUORITYSOURCE is null or PURPOSE is null or VALID_TO is null") + .buildSql("select count(*) from DSGVO", "1=2")) + return countNotFilled == 0; +} + DataPrivacyUtils.openReport = function(pContactId, pReportName, pDSGVOInfo, pLocale) { var DSGVOReport = new Report(pReportName); @@ -478,6 +486,9 @@ Muster-Datenschutzberatung"; } +//////////////////////////////////////////////////////////////////////// +// Deprecated functions: + /** * makes selected data from a private contact anonymous *