From 58abba21f6a0b852114fbb261f29fbea3d795c82 Mon Sep 17 00:00:00 2001 From: Maria Hofmann <m.hofmann@adito.de> Date: Thu, 27 Jun 2019 17:42:38 +0200 Subject: [PATCH] dropDown VALUE, fixes --- entity/DSGVO_entity/DSGVO_entity.aod | 2 + .../opendisclosurereport/onActionProcess.js | 6 +- .../openinforeport/onActionProcess.js | 6 +- .../entityfields/type/dropDownProcess.js | 5 +- .../entityfields/value/dropDownProcess.js | 7 + .../entityfields/value/valueProcess.js | 0 process/DSGVO_lib/process.js | 323 +++--------------- 7 files changed, 71 insertions(+), 278 deletions(-) create mode 100644 entity/DSGVO_entity/entityfields/value/dropDownProcess.js create mode 100644 entity/DSGVO_entity/entityfields/value/valueProcess.js diff --git a/entity/DSGVO_entity/DSGVO_entity.aod b/entity/DSGVO_entity/DSGVO_entity.aod index 5b59e565f0..849252d2b0 100644 --- a/entity/DSGVO_entity/DSGVO_entity.aod +++ b/entity/DSGVO_entity/DSGVO_entity.aod @@ -188,6 +188,8 @@ <name>VALUE</name> <title>Value</title> <mandatory v="true" /> + <dropDownProcess>%aditoprj%/entity/DSGVO_entity/entityfields/value/dropDownProcess.js</dropDownProcess> + <valueProcess>%aditoprj%/entity/DSGVO_entity/entityfields/value/valueProcess.js</valueProcess> </entityField> <entityConsumer> <name>KeywordTablename</name> diff --git a/entity/DSGVO_entity/entityfields/reports/children/opendisclosurereport/onActionProcess.js b/entity/DSGVO_entity/entityfields/reports/children/opendisclosurereport/onActionProcess.js index eb6195e833..62a2806287 100644 --- a/entity/DSGVO_entity/entityfields/reports/children/opendisclosurereport/onActionProcess.js +++ b/entity/DSGVO_entity/entityfields/reports/children/opendisclosurereport/onActionProcess.js @@ -1,5 +1,5 @@ +import("system.vars"); +import("DSGVO_lib"); -var params = {}; -// TODO params for Reports -// TODO open Report \ No newline at end of file +openDSGVOReport(vars.get("$param.currentPerson_param"), "DSGVO_Disclosure_Report"); \ No newline at end of file diff --git a/entity/DSGVO_entity/entityfields/reports/children/openinforeport/onActionProcess.js b/entity/DSGVO_entity/entityfields/reports/children/openinforeport/onActionProcess.js index eb6195e833..1ad478ca81 100644 --- a/entity/DSGVO_entity/entityfields/reports/children/openinforeport/onActionProcess.js +++ b/entity/DSGVO_entity/entityfields/reports/children/openinforeport/onActionProcess.js @@ -1,5 +1,5 @@ +import("system.vars"); +import("DSGVO_lib"); -var params = {}; -// TODO params for Reports -// TODO open Report \ No newline at end of file +openDSGVOReport(vars.get("$param.currentPerson_param"), "DSGVO_Information_report"); \ No newline at end of file diff --git a/entity/DSGVO_entity/entityfields/type/dropDownProcess.js b/entity/DSGVO_entity/entityfields/type/dropDownProcess.js index 756a59c2c1..21ead82518 100644 --- a/entity/DSGVO_entity/entityfields/type/dropDownProcess.js +++ b/entity/DSGVO_entity/entityfields/type/dropDownProcess.js @@ -1,9 +1,6 @@ -import("system.logging"); -import("DSGVO_lib"); import("system.result"); import("system.vars"); -import("Keyword_lib") -import("KeywordRegistry_basic"); +import("DSGVO_lib"); var res = getDSGVOTypes(vars.get("$param.currentPerson_param"), vars.get("$field.TABLENAME")); diff --git a/entity/DSGVO_entity/entityfields/value/dropDownProcess.js b/entity/DSGVO_entity/entityfields/value/dropDownProcess.js new file mode 100644 index 0000000000..72f05bd509 --- /dev/null +++ b/entity/DSGVO_entity/entityfields/value/dropDownProcess.js @@ -0,0 +1,7 @@ +import("system.result"); +import("system.vars"); +import("DSGVO_lib"); + +var res = getDSGVOValues(vars.get("$param.currentPerson_param"), vars.get("$field.TABLENAME"), vars.get("$field.TYPE")); + +result.object(res); \ No newline at end of file diff --git a/entity/DSGVO_entity/entityfields/value/valueProcess.js b/entity/DSGVO_entity/entityfields/value/valueProcess.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/process/DSGVO_lib/process.js b/process/DSGVO_lib/process.js index 7ce7cd5d12..f8059603f1 100644 --- a/process/DSGVO_lib/process.js +++ b/process/DSGVO_lib/process.js @@ -11,11 +11,11 @@ import("system.neon"); import("system.result"); import("Report_lib"); +// TODO Funktionen aus Adito5 übernehmen und anpassen + function getDSGVOTypes (pPerson, pTablename) { - // return "combo" - var res = []; var tablename = KeywordUtils.getViewValue($KeywordRegistry.DSGVOTablename(), pTablename); @@ -50,8 +50,6 @@ function getDSGVOTypes (pPerson, pTablename) return res; }else if(tablename == "Persönliche Daten") { - // TODO beide aus Keyword - res.push(["N", KeywordUtils.getViewValue($KeywordRegistry.DSGVOType(), "dcc34a11-c86b-4acd-9987-e88c98b5b4c5")]); res.push(["O", KeywordUtils.getViewValue($KeywordRegistry.DSGVOType(), "c626726a-a696-4926-9b0f-c320c410463e")]); return res; @@ -59,280 +57,75 @@ function getDSGVOTypes (pPerson, pTablename) return res; } -function getDSGVOTable (pPerson, pTablename) + +function getDSGVOValues(pPerson, pTablename, pType) { - + var res = []; + var tablename = KeywordUtils.getViewValue($KeywordRegistry.DSGVOTablename(), pTablename); + // TODO überall Typ abfragen!! + // KeywordUtils.getViewValue($KeywordRegistry.addressType(), pType);, wenn KEYID da drin gespeichert + // dazu, siehe getDSGVOTypes if (tablename == "Adressen") { - }else if(tablename == "Kommunikationsdaten") - { - }else if(tablename == "Eigenschaft") - { - - }else if(tablename == "Persönliche Daten") - { - - } - /* - var table = vars.get("$field.TABLENAME"); - var container = $KeywordRegistry.DSGVOTablename(); - var data; - var entry = new Object{Type:String, value:String}; - var list = []; - - if (exists(table, container)) - { - if(KeywordUtils.getViewValue(container, table) == "Adressen") - { - data = 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")); - - } - else if(KeywordUtils.getViewValue(container, table) == "Kommunikationsdaten") - { - data = 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")); - - } - else if(KeywordUtils.getViewValue(container, table) == "Attribute") - { - - } - else if(KeywordUtils.getViewValue(container, table) == "Persönliche Daten") + 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")); + + var addrVal = ""; + addr.forEach(function (addrRow) { - data = db.table(SqlCondition.begin() - .andPrepare("PERSON.PERSONID", pPerson) - .buildSql("select PERSONID, DATEOFBIRTH, FIRSTNAME, MIDDLENAME, LASTNAME, GENDER, SALUTATION, TITLE, TITLESUFFIX, PICTURE from PERSON", "1 = 1")); - - for(i = 0; i < pers.length; i++) - { - if(pers[i][1] != null) - { - // TODO - list.push({Type:"123", value:"123"}); - mediumData.push(pers[i][0] + " Date of Birth"); - valueData.push(pers[i][1]); - } - if(pers[i][2] != null) - { - mediumData.push(pers[i][0] + " Firstname"); - valueData.push(pers[i][2]); - } - if(pers[i][3] != null) - { - mediumData.push(pers[i][0] + " Middlename"); - valueData.push(pers[i][3]); - } - if(pers[i][4] != null) - { - mediumData.push(pers[i][0] + " Lastname"); - valueData.push(pers[i][4]); - persEntry = pers[i][4]; - } - if(pers[i][5] != null) - { - mediumData.push(pers[i][0] + " Gender"); - valueData.push(pers[i][5]); - } - if(pers[i][6] != null) - { - mediumData.push(pers[i][0] + " Salutation"); - valueData.push(pers[i][6]); - } - if(pers[i][7] != null) - { - mediumData.push(pers[i][0] + " Title"); - valueData.push(pers[i][7]); - } - if(pers[i][8] != null) - { - mediumData.push(pers[i][0] + " Title suffix"); - valueData.push(pers[i][8]); - } - if(pers[i][9] != null) { - mediumData.push(pers[i][0] + " Picture"); - valueData.push(pers[i][9]); - if(persEntry == null) - persEntry = pers[i][9]; - } - } - } - else return null; -}*/ - - 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")); - - var comm = db.table(SqlCondition.begin() - //.andPrepare("COMMUNICATION.CONTACT_ID", vars.get("$field.CONTACT_ID")) - .andPrepare("CONTACT.PERSON_ID", pPerson) - .buildSql("select COMMUNICATIONID, ADDR, MEDIUM_ID from COMMUNICATION join CONTACT on COMMUNICATION.CONTACT_ID = CONTACTID", "1 = 1")); - //var sql3 = db.table(SqlCondition.begin().andPrepare("AB_ATTRIBUTE.CONTACT_ID", vars.get("$field.CONTACT_ID")).buildSql("select * from AB_ATTRIBUTE", "1 = 1")); - 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")); - - // var data = new Array(); - var mediumData = new Array(); - var valueData = new Array(); - var allData = new Array(); - - for(i = 0; i < addr.length; i++) + addrVal = addrRow[1] + " " + addrRow[2] + " " + addrRow[3] + " "+ addrRow[4] + " " + + addrRow[5] + " " + addrRow[6] + " " + addrRow[7] + " " + + addrRow[8] + " " + addrRow[9] + " " + addrRow[10]; + res.push([addrRow[0], addrVal]); + }); + return res; + }else if(tablename == "Kommunikationsdaten") { - var addrEntry = null; - if(addr[i][1] != null) - { - mediumData.push(addr[i][0] + " Street"); - valueData.push(addr[i][1]); - } - if(addr[i][2] != null) - { - mediumData.push(addr[i][0] + " Addressaddition"); - valueData.push(addr[i][2]); - } - if(addr[i][3] != null) - { - mediumData.push(addr[i][0] + " Addressident"); - valueData.push(addr[i][3]); - } - if(addr[i][4] != null) - { - mediumData.push(addr[i][0] + " Buildingno"); - valueData.push(addr[i][4]); - } - if(addr[i][5] != null) - { - mediumData.push(addr[i][0] + " City"); - valueData.push(addr[i][5]); - addrEntry = addr[i][5]; - } - if(addr[i][6] != null) - { - mediumData.push(addr[i][0] + " Country"); - valueData.push(addr[i][6]); - } - if(addr[i][7] != null) - { - mediumData.push(addr[i][0] + " District"); - valueData.push(addr[i][7]); - if(addrEntry == null) - addrEntry = addr[i][7]; - } - if(addr[i][8] != null) - { - mediumData.push(addr[i][0] + " Region"); - valueData.push(addr[i][8]); - if(addrEntry == null) - addrEntry = addr[i][8]; - } - if(addr[i][9] != null) - { - mediumData.push(addr[i][0] + " State"); - valueData.push(addr[i][9]); - } - if(addr[i][10] != null) + 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")); + comm.forEach(function (entry) { - mediumData.push(addr[i][0] + " ZIP"); - valueData.push(addr[i][10]); - if(addrEntry == null) - addrEntry = addr[i][10]; - } - if(addrEntry != null) - allData.push([addr[i][0] + "-address", addrEntry]); - } - - for(i = 0; i < comm.length; i++) + logging.log("com" + entry); + res.push([entry[0], entry[1]]) + }) + }else if(tablename == "Eigenschaft") { - if(comm[i][1] && comm[i][2]) + var attr = AttributeRelationUtils.getAllAttributes(pPerson, "Person"); + logging.log(attr); + attr.forEach(function (entry) { - var medium = KeywordUtils.getViewValue($KeywordRegistry.communicationMedium(), comm[i][2]); - if(medium != null) - { - mediumData.push(medium) - valueData.push(comm[i][1]); - allData.push([comm[i][0] + "-communication", medium]) - } - } - } - - for(i = 0; i < pers.length; i++) + // TODO muss erst mal attr was liefern.... + res.push(["", ""]); + }) + return res; + }else if(tablename == "Persönliche Daten") { - var persEntry = null; - if(pers[i][1] != null) - { - mediumData.push(pers[i][0] + " Date of Birth"); - valueData.push(pers[i][1]); - } - if(pers[i][2] != null) - { - mediumData.push(pers[i][0] + " Firstname"); - valueData.push(pers[i][2]); - } - if(pers[i][3] != null) - { - mediumData.push(pers[i][0] + " Middlename"); - valueData.push(pers[i][3]); - } - if(pers[i][4] != null) - { - mediumData.push(pers[i][0] + " Lastname"); - valueData.push(pers[i][4]); - persEntry = pers[i][4]; - } - if(pers[i][5] != null) - { - mediumData.push(pers[i][0] + " Gender"); - valueData.push(pers[i][5]); - } - if(pers[i][6] != null) - { - mediumData.push(pers[i][0] + " Salutation"); - valueData.push(pers[i][6]); - } - if(pers[i][7] != null) - { - mediumData.push(pers[i][0] + " Title"); - valueData.push(pers[i][7]); - } - if(pers[i][8] != null) + + 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")); + // var typeViewVal = KeywordUtils.getViewValue($KeywordRegistry.DSGVOType(), pType); + switch (pType) { - mediumData.push(pers[i][0] + " Title suffix"); - valueData.push(pers[i][8]); - } - if(pers[i][9] != null) { - mediumData.push(pers[i][0] + " Picture"); - valueData.push(pers[i][9]); - if(persEntry == null) - persEntry = pers[i][9]; + // TODO Inhalt von other prüfen!! + case "N": // 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 + res.push(["other", (pers[0][9] + pers[0][1] + ", " + pers[0][5])]); + return res; } - - if(persEntry != null) - allData.push([pers[i][0] + "-person", persEntry]); } - + return res; - if(pTablename == "medium") - { - return mediumData; - } - else if(pTablename == "value") - { - return valueData; - } - else if(pTablename == "combo") - { - return allData; - } - else - return null; } -function openDSGVODisclosureReport(pPerson) + +function openDSGVOReport(pPerson, pReportName) { - var discReport = new Report("DSGVO_Disclosure_Report"); + var discReport = new Report(pReportName); // TODO: get Images implementieren var imgData = ["meineFirma | Konrad-Zuse-Straße 4 | DE 84144 Geisenhausen", @@ -360,12 +153,6 @@ function openDSGVODisclosureReport(pPerson) discReport.openReport(); // pCondition, pVariables } -function openDSGVOInformationReport(pPerson) -{ - var infoReport = new Report("DSGVO_Information_report"); -} - - function insertUpdatePrivacyData(pTableData, pPersRelId){ -- GitLab