From 59d188e44142d4aef51ea4bc4d9824bf57d33647 Mon Sep 17 00:00:00 2001 From: "j.goderbauer" <j.goderbauer@jgoderbauer2.aditosoftware.local> Date: Fri, 24 Jan 2020 17:13:45 +0100 Subject: [PATCH] DSGVO: several bugfixes --- process/DataPrivacy_lib/process.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/process/DataPrivacy_lib/process.js b/process/DataPrivacy_lib/process.js index 4d42d2d37e..f1bda31c81 100644 --- a/process/DataPrivacy_lib/process.js +++ b/process/DataPrivacy_lib/process.js @@ -174,11 +174,14 @@ DataPrivacyType.get = function(pKey) { // Todo Format or set content dsgvotype var persData = _selectPersonal(pContactId, pContactIdSaved, ["DATEOFBIRTH"]); - - return [{ - value: persData.DATEOFBIRTH, - id: persData.CONTACTID - }] + + if (persData.DATEOFBIRTH) + return [{ + value: persData.DATEOFBIRTH, + id: persData.CONTACTID + }]; + else + return []; } /** @@ -320,7 +323,7 @@ DataPrivacyUtils.getDSGVO = function(pContactId, pFilterCond) KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.dsgvoType(), "DSGVOTYPE")) // 12 - dsgvotype-displayvalue) .from("DSGVO") .where("DSGVO.CONTACT_ID", pContactId) - .and(pFilterCond) + .andIfSet(pFilterCond) .table(); } @@ -363,6 +366,8 @@ DataPrivacyUtils.collectAll = function(pContactId, pFilterCond) data.forEach(function(pRow) { + if(pRow.value == "")//when the value is empty there is no need to insert the records since they'd been deleted later in the function + return; // search if it is already in DSGVO table var found = false; for (dat in contactDSGVO) @@ -415,7 +420,7 @@ DataPrivacyUtils.collectAll = function(pContactId, pFilterCond) if (!pRow[4]) { if (pRow[0]) - deletes.push(["DSGVO", newWhere("DSGVO.DSGVOID", pRow[0])]); + deletes.push(["DSGVO", newWhere("DSGVO.DSGVOID", pRow[0]).build()]); return false; } -- GitLab