From cadee3051a758bf378d43c4009e59b425117ea93 Mon Sep 17 00:00:00 2001 From: Maria Hofmann <m.hofmann@adito.de> Date: Mon, 1 Jul 2019 10:41:27 +0200 Subject: [PATCH] fix communication --- .../2019.1.4/DSGVO/update_comm_medium.xml | 13 ----- .../Data_alias/basic/2019.1.4/changelog.xml | 1 - .../recordcontainers/jdito/onInsert.js | 29 ++++++++++ process/DSGVO_lib/process.js | 57 ++++++++++++++----- 4 files changed, 72 insertions(+), 28 deletions(-) delete mode 100644 .liquibase/Data_alias/basic/2019.1.4/DSGVO/update_comm_medium.xml create mode 100644 entity/DSGVO_entity/recordcontainers/jdito/onInsert.js diff --git a/.liquibase/Data_alias/basic/2019.1.4/DSGVO/update_comm_medium.xml b/.liquibase/Data_alias/basic/2019.1.4/DSGVO/update_comm_medium.xml deleted file mode 100644 index 81b50077257..00000000000 --- a/.liquibase/Data_alias/basic/2019.1.4/DSGVO/update_comm_medium.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.1" encoding="UTF-8" standalone="no"?> -<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> - <changeSet author="m.hofmann" id="e6b32d7d-298c-44a3-901f-88baa77cb6c3"> - <update tableName="COMMUNICATION"> - <column name="MEDIUM_ID" value="COMMINTERNET"></column> - <where>MEDIUM_ID = ?</where> - <whereParams> - <param value="d9434c95-9abb-4661-a4c0-65d8a9eb676e"></param> - </whereParams> - </update> - </changeSet> -</databaseChangeLog> - diff --git a/.liquibase/Data_alias/basic/2019.1.4/changelog.xml b/.liquibase/Data_alias/basic/2019.1.4/changelog.xml index 57c4dcd3fa8..977434f5eff 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/changelog.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/changelog.xml @@ -159,7 +159,6 @@ <include relativeToChangelogFile="true" file="DSGVO/init_purpose_keyword.xml"/> <include relativeToChangelogFile="true" file="DSGVO/init_dsgvotablename_keyword.xml"/> <include relativeToChangelogFile="true" file="DSGVO/init_dsgvoType_keyword.xml"/> - <include relativeToChangelogFile="true" file="DSGVO/update_comm_medium.xml"/> <include relativeToChangelogFile="true" file="AditoBasic/init_UnlinkedMail.xml"/> diff --git a/entity/DSGVO_entity/recordcontainers/jdito/onInsert.js b/entity/DSGVO_entity/recordcontainers/jdito/onInsert.js new file mode 100644 index 00000000000..fc04b1b0409 --- /dev/null +++ b/entity/DSGVO_entity/recordcontainers/jdito/onInsert.js @@ -0,0 +1,29 @@ +import("system.db"); +import("system.vars"); + +var columns = [ + "CONTACT_ID", + "DATE_NEW", + "PURPOSE", + "ROW_ID", + "STATUORITYSOURCE", + "TABLENAME", + "TYPE", + "DSGVOID", + "USER_NEW", + "VALID_TO" +]; +var values = [ + vars.get("$field.CONTACT_ID"), + vars.get("$field.DATE_NEW"), + vars.get("$field.PURPOSE"), + vars.get("$field.ROW_ID"), + vars.get("$field.STATUORITYSOURCE"), + vars.get("$field.TABLENAME"), + vars.get("$field.TYPE"), + vars.get("$field.UID"), + vars.get("$field.USER_NEW"), + vars.get("$field.VALID_TO") +]; + +db.insertData("DSGVO", columns, null, values); \ No newline at end of file diff --git a/process/DSGVO_lib/process.js b/process/DSGVO_lib/process.js index 81e1f2256bc..452c9511d1a 100644 --- a/process/DSGVO_lib/process.js +++ b/process/DSGVO_lib/process.js @@ -33,15 +33,15 @@ function getDSGVOTypes (pPerson, pTablename) return res; }else if(tablename == "Kommunikationsdaten") { - logging.log("comm"); + //logging.log("comm"); var comm = db.table(SqlCondition.begin() .andPrepare("CONTACT.PERSON_ID", pPerson) .buildSql("select MEDIUM_ID from COMMUNICATION join CONTACT on COMMUNICATION.CONTACT_ID = CONTACTID", "1 = 1", "group by MEDIUM_ID")); - logging.log(JSON.stringify(comm, null, "\t")); + //logging.log(JSON.stringify(comm, null, "\t")); comm.forEach(function (row) { - logging.log(row[0]); - res.push([row, KeywordUtils.getViewValue($KeywordRegistry.communicationMedium(), row)]); + logging.log(row); + res.push([row[0], KeywordUtils.getViewValue($KeywordRegistry.communicationMedium(), row)]); }); return res; }else if(tablename == "Eigenschaft") @@ -50,8 +50,8 @@ function getDSGVOTypes (pPerson, pTablename) return res; }else if(tablename == "Persönliche Daten") { - res.push(["N", KeywordUtils.getViewValue($KeywordRegistry.DSGVOType(), "dcc34a11-c86b-4acd-9987-e88c98b5b4c5")]); - res.push(["O", KeywordUtils.getViewValue($KeywordRegistry.DSGVOType(), "c626726a-a696-4926-9b0f-c320c410463e")]); + res.push(["names", KeywordUtils.getViewValue($KeywordRegistry.DSGVOType(), "dcc34a11-c86b-4acd-9987-e88c98b5b4c5")]); + res.push(["other", KeywordUtils.getViewValue($KeywordRegistry.DSGVOType(), "c626726a-a696-4926-9b0f-c320c410463e")]); return res; } @@ -69,7 +69,8 @@ function getDSGVOValues(pPerson, pTablename, pType) { var addr = db.table(SqlCondition.begin() .andPrepare("CONTACT.PERSON_ID", pPerson) - .buildSql("select ADDRESSID, ADDRESS, ADDRESSADDITION, ADDRIDENTIFIER, BUILDINGNO, CITY, COUNTRY, DISTRICT, REGION, STATE, ZIP from ADDRESS join CONTACT on ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID", "1 = 1")); + .buildSql("select ADDRESSID, ADDRESS, ADDRESSADDITION, ADDRIDENTIFIER, BUILDINGNO, CITY, COUNTRY, DISTRICT, REGION, STATE, ZIP " + + "from ADDRESS join CONTACT on ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID", "1 = 1")); var addrVal = ""; addr.forEach(function (addrRow) @@ -84,12 +85,15 @@ function getDSGVOValues(pPerson, pTablename, pType) { var comm = db.table(SqlCondition.begin() .andPrepare("CONTACT.PERSON_ID", pPerson) - .buildSql("select COMMUNICATIONID, ADDR, MEDIUM_ID from COMMUNICATION join CONTACT on COMMUNICATION.CONTACT_ID = CONTACTID", "1 = 1")); + .buildSql("select COMMUNICATIONID, ADDR, MEDIUM_ID " + + "from COMMUNICATION join CONTACT on COMMUNICATION.CONTACT_ID = CONTACTID", "1 = 1")); + //logging.log(pType); comm.forEach(function (entry) { - logging.log("com" + entry); - res.push([entry[0], entry[1]]) - }) + logging.log("com " + entry[0] + " " + entry[1] + ", " + pType); + if(pType == entry[2]) + res.push([entry[2], entry[1]]); + }); }else if(tablename == "Eigenschaft") { var attr = AttributeRelationUtils.getAllAttributes(pPerson, "Person"); @@ -105,15 +109,16 @@ function getDSGVOValues(pPerson, pTablename, pType) var pers = db.table(SqlCondition.begin() .andPrepare("PERSON.PERSONID", pPerson) - .buildSql("select PERSONID, DATEOFBIRTH, FIRSTNAME, MIDDLENAME, LASTNAME, GENDER, SALUTATION, TITLE, TITLESUFFIX, PICTURE from PERSON", "1 = 1")); + .buildSql("select PERSONID, DATEOFBIRTH, FIRSTNAME, MIDDLENAME, LASTNAME, GENDER, SALUTATION, TITLE, TITLESUFFIX, PICTURE " + + "from PERSON", "1 = 1")); // var typeViewVal = KeywordUtils.getViewValue($KeywordRegistry.DSGVOType(), pType); switch (pType) { // TODO Inhalt von other prüfen!! - case "N": // names + case "names": // names res.push(["names", (pers[0][6] + " " + pers[0][7] + " " + pers[0][8] + " " + pers[0][2] + " " + pers[0][3] + " " + pers[0][4])]); return res; - case "O": // Sonstige Persönliche Daten + case "other": // Sonstige Persönliche Daten res.push(["other", (pers[0][9] + pers[0][1] + ", " + pers[0][5])]); return res; } @@ -122,6 +127,30 @@ function getDSGVOValues(pPerson, pTablename, pType) } +function getSpecificRowId(pTablename, pPerson) +{ + var res = []; + var tablename = KeywordUtils.getViewValue($KeywordRegistry.DSGVOTablename(), pTablename); + + if (tablename == "Adressen") + { + return db.cell(SqlCondition.begin() + .andPrepare("CONTACT.PERSON_ID", pPerson) + .buildSql("select ADDRESSID from ADDRESS join CONTACT on ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID", "1 = 1")); + }else if(tablename == "Kommunikationsdaten") + { + return db.cell(SqlCondition.begin() + .andPrepare("CONTACT.PERSON_ID", pPerson) + .buildSql("select COMMUNICATIONID from COMMUNICATION join CONTACT on COMMUNICATION.CONTACT_ID = CONTACTID", "1 = 1")); + }else if(tablename == "Eigenschaft") + { + + }else if(tablename == "Persönliche Daten") + { + return pPerson; + } + +} function openDSGVOReport(pPerson, pReportName) { -- GitLab