From 139a156fc0785e8889569375e03e57900399af98 Mon Sep 17 00:00:00 2001 From: Maria Hofmann <m.hofmann@adito.de> Date: Thu, 27 Jun 2019 16:49:22 +0200 Subject: [PATCH] dropdown Type --- .../DSGVO/init_dsgvotablename_keyword.xml | 2 +- entity/Address_entity/Address_entity.aod | 12 +- entity/DSGVO_entity/DSGVO_entity.aod | 11 +- .../organisationid_param/valueProcess.js | 0 .../tablename/displayValueProcess.js | 6 +- .../entityfields/tablename/dropDownProcess.js | 5 + .../entityfields/type/displayValueProcess.js | 25 -- .../entityfields/type/dropDownProcess.js | 5 + .../recordcontainers/jdito/contentProcess.js | 37 +- process/DSGVO_lib/process.js | 334 +++++++++++------- 10 files changed, 254 insertions(+), 183 deletions(-) create mode 100644 entity/DSGVO_entity/entityfields/contactadresses/children/organisationid_param/valueProcess.js create mode 100644 entity/DSGVO_entity/entityfields/tablename/dropDownProcess.js diff --git a/.liquibase/Data_alias/basic/2019.1.4/DSGVO/init_dsgvotablename_keyword.xml b/.liquibase/Data_alias/basic/2019.1.4/DSGVO/init_dsgvotablename_keyword.xml index 0782f8b1b50..4b3c3f7b86e 100644 --- a/.liquibase/Data_alias/basic/2019.1.4/DSGVO/init_dsgvotablename_keyword.xml +++ b/.liquibase/Data_alias/basic/2019.1.4/DSGVO/init_dsgvotablename_keyword.xml @@ -22,7 +22,7 @@ <insert tableName="AB_KEYWORD_ENTRY"> <column name="AB_KEYWORD_ENTRYID" value="012270f0-b975-489d-883b-b38317390228"/> <column name="KEYID" value="5fe90cba-c5f1-43f4-a213-895c201d02ea"/> - <column name="TITLE" value="Attribute"/> + <column name="TITLE" value="Eigenschaft"/> <column name="CONTAINER" value="DSGVOTablename"/> <column name="SORTING" valueNumeric="2"/> <column name="ISACTIVE" valueNumeric="1"/> diff --git a/entity/Address_entity/Address_entity.aod b/entity/Address_entity/Address_entity.aod index b3663c0babe..82c1722f9df 100644 --- a/entity/Address_entity/Address_entity.aod +++ b/entity/Address_entity/Address_entity.aod @@ -142,12 +142,6 @@ <fieldName>ContactAddresses</fieldName> <isConsumer v="false" /> </entityDependency> - <entityDependency> - <name>87260b21-5c3f-452c-9a0b-d3f5dcf7637d</name> - <entityName>DSGVO_entity</entityName> - <fieldName>ContactAdresses</fieldName> - <isConsumer v="false" /> - </entityDependency> </dependencies> <children> <entityParameter> @@ -242,6 +236,12 @@ <fieldName>PossibleAddresses</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>716aac15-99cb-4032-bf97-06101f0718f3</name> + <entityName>DSGVO_entity</entityName> + <fieldName>OrganisationAndContactAdresses</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> diff --git a/entity/DSGVO_entity/DSGVO_entity.aod b/entity/DSGVO_entity/DSGVO_entity.aod index a2fc7270fe8..5b59e565f04 100644 --- a/entity/DSGVO_entity/DSGVO_entity.aod +++ b/entity/DSGVO_entity/DSGVO_entity.aod @@ -70,6 +70,7 @@ <groupable v="true" /> <linkedContext>KeywordEntry</linkedContext> <mandatory v="true" /> + <dropDownProcess>%aditoprj%/entity/DSGVO_entity/entityfields/tablename/dropDownProcess.js</dropDownProcess> <displayValueProcess>%aditoprj%/entity/DSGVO_entity/entityfields/tablename/displayValueProcess.js</displayValueProcess> </entityField> <entityField> @@ -87,12 +88,18 @@ <valueProcess>%aditoprj%/entity/DSGVO_entity/entityfields/contact_id/valueProcess.js</valueProcess> </entityField> <entityConsumer> - <name>ContactAdresses</name> + <name>OrganisationAndContactAdresses</name> <dependency> <name>dependency</name> <entityName>Address_entity</entityName> - <fieldName>ContactAddresses</fieldName> + <fieldName>OrganisationAndContactAddresses</fieldName> </dependency> + <children> + <entityParameter> + <name>OrganisationId_param</name> + <valueProcess>%aditoprj%/entity/DSGVO_entity/entityfields/contactadresses/children/organisationid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> </entityConsumer> <entityConsumer> <name>KeywordPurpose</name> diff --git a/entity/DSGVO_entity/entityfields/contactadresses/children/organisationid_param/valueProcess.js b/entity/DSGVO_entity/entityfields/contactadresses/children/organisationid_param/valueProcess.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/entity/DSGVO_entity/entityfields/tablename/displayValueProcess.js b/entity/DSGVO_entity/entityfields/tablename/displayValueProcess.js index 0dfee046adb..63d3863e5be 100644 --- a/entity/DSGVO_entity/entityfields/tablename/displayValueProcess.js +++ b/entity/DSGVO_entity/entityfields/tablename/displayValueProcess.js @@ -1,5 +1,7 @@ +import("system.vars"); +import("KeywordRegistry_basic"); import("Keyword_lib"); import("system.result"); - -result.string(KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.DSGVOTablename(), "DSGVO.TABLENAME")); \ No newline at end of file +if(vars.get("$field.TABLENAME")) +result.string(KeywordUtils.getViewValue($KeywordRegistry.DSGVOTablename(), vars.get("$field.TABLENAME"))); diff --git a/entity/DSGVO_entity/entityfields/tablename/dropDownProcess.js b/entity/DSGVO_entity/entityfields/tablename/dropDownProcess.js new file mode 100644 index 00000000000..fd68131404c --- /dev/null +++ b/entity/DSGVO_entity/entityfields/tablename/dropDownProcess.js @@ -0,0 +1,5 @@ +import("system.result"); +import("Keyword_lib"); +import("KeywordRegistry_basic"); + +result.object(KeywordUtils.getEntryNamesAndIdsByContainer($KeywordRegistry.DSGVOTablename())); \ No newline at end of file diff --git a/entity/DSGVO_entity/entityfields/type/displayValueProcess.js b/entity/DSGVO_entity/entityfields/type/displayValueProcess.js index 5105563a66b..e69de29bb2d 100644 --- a/entity/DSGVO_entity/entityfields/type/displayValueProcess.js +++ b/entity/DSGVO_entity/entityfields/type/displayValueProcess.js @@ -1,25 +0,0 @@ -import("system.db"); -import("KeywordRegistry_basic"); -import("system.result"); -import("Keyword_lib"); -import("Keyword_lib"); -import("system.vars"); - -var tablename = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.DSGVOTablename(), "DSGVO.TABLENAME"); -var res; -if (tablename == "Adressen") -{ - var addrIdent = db.cell(innerCond.andPrepare(vars.get("$field.ROW_ID"), "ADDRESSID") - .buildSql("select ADDRESSIDENTIFIER " - + "from ADDRESS", "1 = 1")); - if(addrIdent) - res = KeywordUtils.getViewValue($KeywordRegistry.addressType(), vars.get("$field.TYPE")) + " | " + addrIdent; -}else if(tablename == "Kommunikationsdaten") -{ - res = KeywordUtils.getViewValue($KeywordRegistry.communicationMedium(), vars.get("$field.TYPE")); -}else // Pers. Daten und Attribute -{ - res = KeywordUtils.getViewValue($KeywordRegistry.DSGVOType(), vars.get("$field.TYPE")); -} - -result.string(res); \ 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 88f18f20c27..756a59c2c18 100644 --- a/entity/DSGVO_entity/entityfields/type/dropDownProcess.js +++ b/entity/DSGVO_entity/entityfields/type/dropDownProcess.js @@ -1,5 +1,10 @@ import("system.logging"); +import("DSGVO_lib"); +import("system.result"); import("system.vars"); import("Keyword_lib") import("KeywordRegistry_basic"); +var res = getDSGVOTypes(vars.get("$param.currentPerson_param"), vars.get("$field.TABLENAME")); + +result.object(res); \ No newline at end of file diff --git a/entity/DSGVO_entity/recordcontainers/jdito/contentProcess.js b/entity/DSGVO_entity/recordcontainers/jdito/contentProcess.js index dd62987d23b..7cecf7abe68 100644 --- a/entity/DSGVO_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/DSGVO_entity/recordcontainers/jdito/contentProcess.js @@ -15,11 +15,11 @@ if (vars.exists("$param.currentPerson_param") && person) recordCond.andPrepareVars("DSGVO.CONTACT_ID", "$param.currentPerson_param"); if (vars.exists("$local.idvalues") && vars.get("$local.idvalues") && vars.get("$local.idvalues").length > 0) - { - recordCond.andIn("DSGVO.DSGVOID", vars.get("$local.idvalues")); - // TODO JH fragen - // person = vars.get("$local.idvalues"); - } +{ + recordCond.andIn("DSGVO.DSGVOID", vars.get("$local.idvalues")); +// TODO JH fragen +// person = vars.get("$local.idvalues"); +} var data = db.table(recordCond.buildSql("select DSGVOID, ROW_ID, TABLENAME, TYPE, STATUORITYSOURCE, PURPOSE, VALID_TO, CONTACT_ID, DATE_NEW, DATE_EDIT, USER_NEW, USER_EDIT from DSGVO ", "1 = 2")); @@ -49,14 +49,14 @@ function _groupData(pData, pPerson) case "Adressen": var addrData = db.table(innerCond.andPrepare("ADDRESS.ADDRESSID", pData[i][1]) // RowId .buildSql("select ADDRESSID, ADDRESS, ADDRESSADDITION, ADDRIDENTIFIER, " - + "BUILDINGNO, CITY, COUNTRY, DISTRICT, REGION, CONTACT_ID, STATE, ZIP, ADDR_TYPE " - + "from ADDRESS", "1 = 1")); + + "BUILDINGNO, CITY, COUNTRY, DISTRICT, REGION, CONTACT_ID, STATE, ZIP, ADDR_TYPE " + + "from ADDRESS", "1 = 1")); if(addrData.length == 1) { // TODO Addresse formatiert // AddrObject(pContactId, pPerson, pAddressId) - //var addrVal = AddrObject(pData[i][7], true); // Person pData[i][7] addr Contact_ID: addrData[9] + //var addrVal = AddrObject(pData[i][7]); // Person pData[i][7] addr Contact_ID: addrData[9] //var addrVal = AddrObject(pData[i][7], true, pData[i][1]); //addrData[0][9], true, addrData[0][0]); var addrVal = ""; addrData[0].forEach(function(entry) @@ -104,8 +104,25 @@ function _groupData(pData, pPerson) pData[i][11]]); } break; - case "Attribute": - var attr = AttributeRelationUtils.getAllAttributes(pPerson, pObjectType, pUseAttributeIds, pUseIdValues) + case "Eigenschaft": + var attr = AttributeRelationUtils.getAllAttributes(pPerson, "Person"); + // TODO prüfen + var attrVal = attr[0][1]; + logging.log(attrVal); + // Zeile: [attributeId|attributeName, value] + res.push([pData[i][0], + pData[i][1], + pData[i][2], + pData[i][3], + attrVal, + pData[i][4], + pData[i][5], + pData[i][6], + pData[i][7], + pData[i][8], + pData[i][9], + pData[i][10], + pData[i][11]]); break; case "Persönliche Daten": var pers = db.table(SqlCondition.begin() diff --git a/process/DSGVO_lib/process.js b/process/DSGVO_lib/process.js index dcb635d3528..7ce7cd5d122 100644 --- a/process/DSGVO_lib/process.js +++ b/process/DSGVO_lib/process.js @@ -1,3 +1,4 @@ +import("Attribute_lib"); import("system.logging"); import("Keyword_lib") import("KeywordRegistry_basic"); @@ -8,11 +9,70 @@ import("system.vars"); import("system.db"); import("system.neon"); import("system.result"); - import("Report_lib"); + +function getDSGVOTypes (pPerson, pTablename) +{ + // return "combo" + + var res = []; + + var tablename = KeywordUtils.getViewValue($KeywordRegistry.DSGVOTablename(), pTablename); + + if (tablename == "Adressen") + { + var addr = db.table(SqlCondition.begin() + .andPrepare("CONTACT.PERSON_ID", pPerson) + .buildSql("select ADDR_TYPE from ADDRESS join CONTACT on ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID ", "1 = 1", "group by ADDR_TYPE")); + + addr.forEach(function (row) + { + res.push([row, KeywordUtils.getViewValue($KeywordRegistry.addressType(), row)]); + }); + return res; + }else if(tablename == "Kommunikationsdaten") + { + 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")); + comm.forEach(function (row) + { + logging.log(row[0]); + res.push([row, KeywordUtils.getViewValue($KeywordRegistry.communicationMedium(), row)]); + }); + return res; + }else if(tablename == "Eigenschaft") + { + res.push(["E", KeywordUtils.getViewValue($KeywordRegistry.DSGVOType(), "34c2ddb4-97ce-4683-a067-89a38643ecae")]); + 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; + } + + return res; +} function getDSGVOTable (pPerson, pTablename) { + + 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(); @@ -115,159 +175,159 @@ function getDSGVOTable (pPerson, pTablename) .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(); + // var data = new Array(); + var mediumData = new Array(); + var valueData = new Array(); + var allData = new Array(); -for(i = 0; i < addr.length; i++) -{ - var addrEntry = null; - if(addr[i][1] != null) - { - mediumData.push(addr[i][0] + " Street"); - valueData.push(addr[i][1]); - } - if(addr[i][2] != null) + for(i = 0; i < addr.length; i++) { - 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) - { - mediumData.push(addr[i][0] + " ZIP"); - valueData.push(addr[i][10]); - if(addrEntry == null) - addrEntry = addr[i][10]; + 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) + { + 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]); } - if(addrEntry != null) - allData.push([addr[i][0] + "-address", addrEntry]); -} -for(i = 0; i < comm.length; i++) -{ - if(comm[i][1] && comm[i][2]) + for(i = 0; i < comm.length; i++) { - var medium = KeywordUtils.getViewValue($KeywordRegistry.communicationMedium(), comm[i][2]); - if(medium != null) + if(comm[i][1] && comm[i][2]) { - mediumData.push(medium) - valueData.push(comm[i][1]); - allData.push([comm[i][0] + "-communication", medium]) + 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++) -{ - var persEntry = null; - if(pers[i][1] != null) + for(i = 0; i < pers.length; i++) { - 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]); + 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) + { + 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]; + } + + if(persEntry != null) + allData.push([pers[i][0] + "-person", persEntry]); } - if(pers[i][6] != null) + + + if(pTablename == "medium") { - mediumData.push(pers[i][0] + " Salutation"); - valueData.push(pers[i][6]); + return mediumData; } - if(pers[i][7] != null) + else if(pTablename == "value") { - mediumData.push(pers[i][0] + " Title"); - valueData.push(pers[i][7]); + return valueData; } - if(pers[i][8] != null) + else if(pTablename == "combo") { - mediumData.push(pers[i][0] + " Title suffix"); - valueData.push(pers[i][8]); + return allData; } - if(pers[i][9] != null) { - mediumData.push(pers[i][0] + " Picture"); - valueData.push(pers[i][9]); - if(persEntry == null) - persEntry = pers[i][9]; - } - - if(persEntry != null) - allData.push([pers[i][0] + "-person", persEntry]); -} - - -if(pTablename == "medium") -{ - return mediumData; -} -else if(pTablename == "value") -{ - return valueData; -} -else if(pTablename == "combo") -{ - return allData; -} -else - return null; + else + return null; } function openDSGVODisclosureReport(pPerson) -- GitLab