diff --git a/.liquibase/Data_alias/basic/2020.2.1/Loghistory/addAb_loghistoryId.xml b/.liquibase/Data_alias/basic/2020.2.1/Loghistory/addAb_loghistoryId.xml new file mode 100644 index 0000000000000000000000000000000000000000..5386d30054ca978282c55381ef1aaa0b083dc738 --- /dev/null +++ b/.liquibase/Data_alias/basic/2020.2.1/Loghistory/addAb_loghistoryId.xml @@ -0,0 +1,17 @@ +<?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="s.kern" id="d4b5f8bc-b211-442a-b417-3b5d3c92def5"> + <addColumn tableName="AB_LOGHISTORY"> + <column name="AB_LOGHISTORYID" type="CHAR(36)"/> + </addColumn> + <addNotNullConstraint + columnName="AB_LOGHISTORYID" + tableName="AB_LOGHISTORY" + /> + <addPrimaryKey + columnNames="AB_LOGHISTORYID" + constraintName="pk_AB_LOGHISTORYID" + tableName="AB_LOGHISTORY" + /> + </changeSet> +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2020.2.1/Loghistory/changelog.xml b/.liquibase/Data_alias/basic/2020.2.1/Loghistory/changelog.xml new file mode 100644 index 0000000000000000000000000000000000000000..d092637200d1f91da8cb75b1ff1d6af32ea070e6 --- /dev/null +++ b/.liquibase/Data_alias/basic/2020.2.1/Loghistory/changelog.xml @@ -0,0 +1,5 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <include file="addAb_loghistoryId.xml" relativeToChangelogFile="true" /> +</databaseChangeLog> \ No newline at end of file diff --git a/.liquibase/Data_alias/basic/2020.2.1/changelog.xml b/.liquibase/Data_alias/basic/2020.2.1/changelog.xml index 78f40808321fa4d8667d033f0943043319c605e2..46996ff2f3dd7ae477741c1816fb334d512e872a 100644 --- a/.liquibase/Data_alias/basic/2020.2.1/changelog.xml +++ b/.liquibase/Data_alias/basic/2020.2.1/changelog.xml @@ -1,5 +1,5 @@ <?xml version="1.1" encoding="UTF-8" standalone="no"?> <databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> - + <include relativeToChangelogFile="true" file="Loghistory/changelog.xml"/> </databaseChangeLog> diff --git a/.liquibase/Data_alias/changelog.xml b/.liquibase/Data_alias/changelog.xml index c3a1d3c5759b118fd0d3d4e30e38f246a3f28166..9d1ca6c5576dd7a291ee576c6f2847f5f0578a8a 100644 --- a/.liquibase/Data_alias/changelog.xml +++ b/.liquibase/Data_alias/changelog.xml @@ -16,6 +16,7 @@ <include relativeToChangelogFile="true" file="basic/2020.1.2/changelog.xml"/> <include relativeToChangelogFile="true" file="basic/2020.1.3/changelog.xml"/> <include relativeToChangelogFile="true" file="basic/2020.2.0/changelog.xml"/> + <include relativeToChangelogFile="true" file="basic/2020.2.1/changelog.xml"/> <!--enable this only when you definetly want to overwrite the existing data with demo records:--> <!--<include relativeToChangelogFile="true" file="basic/_demoData/changelog.xml" context="example"/>--> diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index b7ca17d42a90e7a96e059ea0cc26b5dfe230153a..96738b180650e265da04ed5ca755f51b7ac40641 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -8025,6 +8025,20 @@ <title></title> <description></description> </entityFieldDb> + <entityFieldDb> + <name>AB_LOGHISTORYID</name> + <dbName></dbName> + <primaryKey v="true" /> + <columnType v="1" /> + <size v="36" /> + <scale v="0" /> + <notNull v="true" /> + <isUnique v="true" /> + <index v="true" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> </entityFields> </entityDb> <entityDb> diff --git a/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod b/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod index 2885448e52c527d22571ddcc5b154cf307bae531..2de36e834097c76b055a391c9ed833036b720f86 100644 --- a/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod +++ b/application/_____SYSTEM_APPLICATION_NEON/_____SYSTEM_APPLICATION_NEON.aod @@ -297,6 +297,10 @@ <kind v="10077" /> <title></title> </entityNode> + <entityNode> + <name>AuditLogHistory</name> + <kind v="10077" /> + </entityNode> <entityNode> <name>ExportTemplate</name> <kind v="10077" /> diff --git a/entity/AuditLogHistory_entity/AuditLogHistory_entity.aod b/entity/AuditLogHistory_entity/AuditLogHistory_entity.aod new file mode 100644 index 0000000000000000000000000000000000000000..39c0a093e54b5dabf2f3a9c5398bcfd1f86aef47 --- /dev/null +++ b/entity/AuditLogHistory_entity/AuditLogHistory_entity.aod @@ -0,0 +1,144 @@ +<?xml version="1.0" encoding="UTF-8"?> +<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.3.17" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.17"> + <name>AuditLogHistory_entity</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <icon>VAADIN:LINES_LIST</icon> + <title>Audit Log</title> + <grantCreate v="false" /> + <grantUpdate v="false" /> + <grantDelete v="true" /> + <grantDeleteProcess>%aditoprj%/entity/AuditLogHistory_entity/grantDeleteProcess.js</grantDeleteProcess> + <initFilterProcess>%aditoprj%/entity/AuditLogHistory_entity/initFilterProcess.js</initFilterProcess> + <titlePlural>Audit Logs</titlePlural> + <recordContainer>db</recordContainer> + <entityFields> + <entityProvider> + <name>#PROVIDER</name> + <targetContextField>TARGET_CONTEXT</targetContextField> + <targetIdField>TARGET_ID</targetIdField> + </entityProvider> + <entityField> + <name>LOGTYPE</name> + <title>Action</title> + <dropDownProcess>%aditoprj%/entity/AuditLogHistory_entity/entityfields/logtype/dropDownProcess.js</dropDownProcess> + </entityField> + <entityField> + <name>DATE_NEW</name> + <title>Date</title> + <contentType>DATE</contentType> + <resolution>MINUTE</resolution> + <state>READONLY</state> + </entityField> + <entityField> + <name>DESCRIPTION</name> + <title>Description</title> + </entityField> + <entityField> + <name>TABLENAME</name> + <title>Tablename</title> + <dropDownProcess>%aditoprj%/entity/AuditLogHistory_entity/entityfields/tablename/dropDownProcess.js</dropDownProcess> + </entityField> + <entityField> + <name>UID</name> + </entityField> + <entityField> + <name>TABLENAMEID</name> + </entityField> + <entityField> + <name>USER_NEW</name> + <title>Editor</title> + <state>READONLY</state> + </entityField> + <entityField> + <name>SOURCE_TABLENAME</name> + </entityField> + <entityField> + <name>SOURCE_TABLENAMEID</name> + </entityField> + <entityField> + <name>TARGET_CONTEXT</name> + <valueProcess>%aditoprj%/entity/AuditLogHistory_entity/entityfields/target_context/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>TARGET_ID</name> + <valueProcess>%aditoprj%/entity/AuditLogHistory_entity/entityfields/target_id/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>PREVIEW_TITLE</name> + <valueProcess>%aditoprj%/entity/AuditLogHistory_entity/entityfields/preview_title/valueProcess.js</valueProcess> + </entityField> + <entityProvider> + <name>#PROVIDER_AGGREGATES</name> + <useAggregates v="true" /> + </entityProvider> + </entityFields> + <recordContainers> + <dbRecordContainer> + <name>db</name> + <alias>Data_alias</alias> + <linkInformation> + <linkInformation> + <name>ed8bd1ca-64eb-443e-a04d-ea7aee0c352a</name> + <tableName>AB_LOGHISTORY</tableName> + <primaryKey>AB_LOGHISTORYID</primaryKey> + <isUIDTable v="false" /> + <readonly v="true" /> + </linkInformation> + </linkInformation> + <recordFieldMappings> + <dbRecordFieldMapping> + <name>UID.value</name> + <recordfield>AB_LOGHISTORY.AB_LOGHISTORYID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>USER_NEW.value</name> + <recordfield>AB_LOGHISTORY.USER_NEW</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>TABLENAMEID.value</name> + <recordfield>AB_LOGHISTORY.TABLENAMEID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>TABLENAME.value</name> + <recordfield>AB_LOGHISTORY.TABLENAME</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>SOURCE_TABLENAMEID.value</name> + <recordfield>AB_LOGHISTORY.SOURCE_TABLENAMEID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>SOURCE_TABLENAME.value</name> + <recordfield>AB_LOGHISTORY.SOURCE_TABLENAME</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>LOGTYPE.value</name> + <recordfield>AB_LOGHISTORY.LOGTYPE</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DESCRIPTION.value</name> + <recordfield>AB_LOGHISTORY.DESCRIPTION</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DATE_NEW.value</name> + <recordfield>AB_LOGHISTORY.DATE_NEW</recordfield> + <isFilterable v="true" /> + </dbRecordFieldMapping> + </recordFieldMappings> + <filterExtensions> + <filterExtension> + <name>contextFilter</name> + <title>Kontext</title> + <contentType>TEXT</contentType> + <filterValuesProcess>%aditoprj%/entity/AuditLogHistory_entity/recordcontainers/db/filterextensions/contextfilter/filterValuesProcess.js</filterValuesProcess> + <filterConditionProcess>%aditoprj%/entity/AuditLogHistory_entity/recordcontainers/db/filterextensions/contextfilter/filterConditionProcess.js</filterConditionProcess> + <isLookupFilter v="true" /> + <filtertype>BASIC</filtertype> + </filterExtension> + </filterExtensions> + </dbRecordContainer> + </recordContainers> +</entity> diff --git a/entity/AuditLogHistory_entity/entityfields/logtype/dropDownProcess.js b/entity/AuditLogHistory_entity/entityfields/logtype/dropDownProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..550422df7f87c47837a76d96c2550017a31c3580 --- /dev/null +++ b/entity/AuditLogHistory_entity/entityfields/logtype/dropDownProcess.js @@ -0,0 +1,8 @@ +import("system.translate"); +import("system.result"); + +result.object([ + ["I", translate.text("Inserted")] + ,["U", translate.text("Updated")] + ,["D", translate.text("Deleted")] + ]); \ No newline at end of file diff --git a/entity/AuditLogHistory_entity/entityfields/preview_title/valueProcess.js b/entity/AuditLogHistory_entity/entityfields/preview_title/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..8094c75ee753168a9fb88cbee3a6671792cf8c64 --- /dev/null +++ b/entity/AuditLogHistory_entity/entityfields/preview_title/valueProcess.js @@ -0,0 +1,40 @@ +import("system.translate"); +import("Sql_lib"); +import("system.result"); +import("system.vars"); + +var context = vars.get("$field.TARGET_CONTEXT"); +var title = ""; + +switch(context) +{ + case "AcquisitionProject": + title = "Acquisition project"; + break; + case "Bulkmail": + case "BULKMAIL": + title = "Bulk mail"; + break; + case "CampaignStep": + title = "Campaign"; + break; + case "DSGVO": + title = "Data Privacy"; + break; + case "SerialLetter": + title = "Serial letter"; + break; + case "Person": + title = "Contact"; + break; + case "Event_context": + title = "Event"; + break; + default: + if(context.length > 1) + { + title = context.substring(0, 1).toUpperCase() + context.substring(1).toLowerCase(); + } +} + +result.string(translate.text(title)); \ No newline at end of file diff --git a/entity/AuditLogHistory_entity/entityfields/tablename/dropDownProcess.js b/entity/AuditLogHistory_entity/entityfields/tablename/dropDownProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..ec9a43cad9e680c2d34e30a49121b4f2e4f5afaa --- /dev/null +++ b/entity/AuditLogHistory_entity/entityfields/tablename/dropDownProcess.js @@ -0,0 +1,5 @@ +import("Sql_lib"); +import("system.result"); + +result.object(newSelect("distinct TABLENAME, TABLENAME").from("AB_LOGHISTORY").orderBy("TABLENAME").table()); + diff --git a/entity/AuditLogHistory_entity/entityfields/target_context/valueProcess.js b/entity/AuditLogHistory_entity/entityfields/target_context/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a3e8a931b1b8273a058c482b9582c864fd77007c --- /dev/null +++ b/entity/AuditLogHistory_entity/entityfields/target_context/valueProcess.js @@ -0,0 +1,109 @@ +import("Sql_lib"); +import("system.result"); +import("system.vars"); + +var tablename = vars.get("$field.TABLENAME"); +var tablenameId = vars.get("$field.TABLENAMEID"); +var isPerson = ""; +var res = ""; + +switch(tablename) +{ + case "AB_ATTRIBUTERELATION": + isPerson = newSelect("PERSON_ID") + .from("CONTACT") + .where("CONTACT.CONTACTID", tablenameId) + .cell(); + if(isPerson) + res = "Person"; + else + res = "Organisation"; + break; + case "AB_OBJECTRELATION": + isPerson = newSelect("CONTACT.PERSON_ID") + .from("CONTACT") + .join("AB_OBJECTRELATION on AB_OBJECTRELATION.OBJECT1_ROWID = CONTACT.CONTACTID") + .where("AB_OBJECTRELATION.AB_OBJECTRELATIONID", tablenameId) + .cell(); + if(isPerson) + res = "Person"; + else + res = "Organisation" + break; + case "ACTIVITYLINK": + case "ACTIVITY": + res = "Activity"; + break; + case "ACQUISITIONPROJECT": + res = "AcquisitionProject"; + break; + case "ASYS_BINARIES": + res = newSelect("ASYS_BINARIES.TABLENAME", "_____SYSTEMALIAS") + .from("ASYS_BINARIES") + .where("ASYS_BINARIES.ID", tablenameId) + .cell(); + break; + case "BULKMAILRECIPIENT": + case "BULKMAIL": + res = "Bulkmail"; + break; + case "CONTACT": + isPerson = newSelect("PERSON_ID") + .from("CONTACT") + .where("CONTACT.CONTACTID", tablenameId) + .cell(); + if(isPerson) + res = "Person"; + else + res = "Organisation"; + break; + case "CAMPAIGNSTEP": + res = "CampaignStep"; + break; + case "CAMPAIGNCOST": + case "CAMPAIGNPARTICIPANT": + case "CAMPAIGN": + res = "Campaign"; + break; + case "DSGVO": + res = "DSGVO"; + break; + case "EVENTPARTICIPANT": + case "EVENT": + res = "Event_context"; + break; + case "ORGANISATION": + res = "Organisation"; + break; + case "OBJECTMEMBER": + res = newSelect("OBJECTMEMBER.OBJECT_TYPE") + .from("OBJECTMEMBER") + .where("OBJECTMEMBER.OBJECTMEMBERID", tablenameId) + .cell(); + break; + case "PERSON": + res = "Person"; + break; + case "SALESORDER": + res = "Salesorder"; + break; + case "SALESPROJECT_MILESTONE": + case "SALESPROJECT": + res = "Salesproject"; + break; + case "LETTERRECIPIENT": + case "SERIALLETTER": + res = "SerialLetter"; + break; + case "TASKLINK": + case "TASK": + res = "Task"; + break; + case "TASKLINK": + res = "TaskLink"; + break; + default: + res = tablename; +} + +result.string(res); \ No newline at end of file diff --git a/entity/AuditLogHistory_entity/entityfields/target_id/valueProcess.js b/entity/AuditLogHistory_entity/entityfields/target_id/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..4af2e504ad734b059aff6913145de95b041d7dba --- /dev/null +++ b/entity/AuditLogHistory_entity/entityfields/target_id/valueProcess.js @@ -0,0 +1,95 @@ +import("Sql_lib"); +import("system.result"); +import("system.vars"); + +var tablename = vars.get("$field.TABLENAME"); +var tablenameid = vars.get("$field.TABLENAMEID"); +var returnId = ""; +var res = tablenameid; + +switch(tablename) +{ + case "AB_OBJECTRELATION": + returnId = newSelect("OBJECT1_ROWID") + .from("AB_OBJECTRELATION") + .where("AB_OBJECTRELATION.AB_OBJECTRELATIONID", tablenameid) + .cell(); + res = returnId; + break; + case "ACTIVITYLINK": + returnId = newSelect("ACTIVITY_ID") + .from("ACTIVITYLINK") + .where("ACTIVITYLINK.ACTIVITYLINKID", tablenameid) + .cell(); + res = returnId; + break; + case "ASYS_BINARIES": + res = newSelect("ASYS_BINARIES.ROW_ID", "_____SYSTEMALIAS") + .from("ASYS_BINARIES") + .where("ASYS_BINARIES.ID", tablenameid) + .cell(); + break; + case "BULKMAILRECIPIENT": + returnId = newSelect("BULKMAIL_ID") + .from("BULKMAILRECIPIENT") + .where("BULKMAILRECIPIENT.BULKMAILRECIPIENTID", tablenameid) + .cell(); + res = returnId; + break; + case "CAMPAIGNCOST": + returnId = newSelect("CAMPAIGNCOST.CAMPAIGN_ID") + .from("CAMPAIGNCOST") + .where("CAMPAIGNCOST.CAMPAIGNCOSTID", tablenameid) + .cell(); + res = returnId; + break; + case "EVENTPARTICIPANT": + returnId = newSelect("EVENTPARTICIPANT.EVENT_ID") + .from("EVENTPARTICIPANT") + .where("EVENTPARTICIPANT.EVENTPARTICIPANTID", tablenameid) + .cell(); + res = returnId; + break; + case "CAMPAIGNPARTICIPANT": + returnId = newSelect("CAMPAIGNPARTICIPANT.CAMPAIGN_ID") + .from("CAMPAIGNPARTICIPANT") + .where("CAMPAIGNPARTICIPANT.CAMPAIGNPARTICIPANTID", tablenameid) + .cell(); + res = returnId; + break; + case "OBJECTMEMBER": + res = newSelect("OBJECTMEMBER.OBJECT_ROWID") + .from("OBJECTMEMBER") + .where("OBJECTMEMBER.OBJECTMEMBERID", tablenameid) + .cell(); + break; + case "PERSON": + res = newSelect("CONTACT.CONTACTID") + .from("CONTACT") + .join("PERSON", "CONTACT.PERSON_ID = PERSON.PERSONID") + .where("PERSON.PERSONID", tablenameid) + .cell(); + break; + case "LETTERRECIPIENT": + returnId = newSelect("LETTERRECIPIENT.SERIALLETTER_ID") + .from("LETTERRECIPIENT") + .where("LETTERRECIPIENT.LETTERRECIPIENTID", tablenameid) + .cell(); + res = returnId; + break; + case "SALESPROJECT_MILESTONE": + returnId = newSelect("SALESPROJECT_MILESTONE.SALESPROJECT_ID") + .from("SALESPROJECT_MILESTONE") + .where("SALESPROJECT_MILESTONE.SALESPROJECT_MILESTONEID", tablenameid) + .cell(); + res = returnId; + break; + case "TASKLINK": + returnId = newSelect("TASKLINK.TASK_ID") + .from("TASKLINK") + .where("TASKLINK.TASKLINKID", tablenameid) + .cell(); + res = returnId; + break; +} +result.string(res); \ No newline at end of file diff --git a/entity/AuditLogHistory_entity/initFilterProcess.js b/entity/AuditLogHistory_entity/initFilterProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a8178441551129fa5dd8ccd88ad7b6b9ff4b6a1c --- /dev/null +++ b/entity/AuditLogHistory_entity/initFilterProcess.js @@ -0,0 +1,28 @@ +import("system.result"); +import("system.neon"); +import("system.datetime"); +import("system.vars"); + +let presMode = vars.get("$sys.presentationmode"); +let curDate = datetime.toDate(vars.get("$sys.date"), "dd.MM.yyyy"); + +if (presMode == neon.CONTEXT_PRESENTATIONMODE_FILTER || presMode == neon.CONTEXT_PRESENTATIONMODE_DASHBOARD) +{ + var filter = { + "type":"group", + "operator":"AND", + "timestamp": curDate, + "childs": + [ + { + "type":"row", + "name":"DATE_NEW", + "operator":"TIMEFRAME_PAST", + "value":"1 Tag", + "key":"REL=FIXED;START=P-1D", + "contenttype":"DATE" + } + ] + }; + result.string(JSON.stringify(filter)); +} \ No newline at end of file diff --git a/entity/AuditLogHistory_entity/recordcontainers/db/filterextensions/contextfilter/filterConditionProcess.js b/entity/AuditLogHistory_entity/recordcontainers/db/filterextensions/contextfilter/filterConditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..8afb448592a8d594ca71658bc738b9a6bef9f6ad --- /dev/null +++ b/entity/AuditLogHistory_entity/recordcontainers/db/filterextensions/contextfilter/filterConditionProcess.js @@ -0,0 +1,91 @@ +import("system.result"); +import("Sql_lib"); +import("Entity_lib"); +import("system.vars"); +import("system.logging"); + +let values = []; +let operator = ""; +let condition = ""; +let additionalCondition = ""; +let setAttrCondition = false; + +switch(vars.get("$local.operator")) +{ + case "1": // equals + operator = " in "; + break; + case "11": // is not empty + operator = " is not null "; + break; + case "2": // not equals + operator = " not in "; + break; + case "12": // is empty + operator = " is null "; + break; +} + +condition = "TABLENAME " + operator; + +if(vars.get("$local.operator") == "1" || vars.get("$local.operator") == "2") +{ + values = [vars.get("$local.value").trim()]; + switch(values[0]) + { + case "'TASK'": + values.push("'TASKLINK'"); + break; + case "'ACTIVITY'": + setAttrCondition = true; + values.push("'ACTIVITYLINK'"); + break; + case "'BULKMAIL'": + values.push("'BULKMAILRECIPIENT'"); + break; + case "'EVENT'": + values.push("'EVENTPARTICIPANT'"); + break; + case "'SALESPROJECT'": + setAttrCondition = true; + values.push("'SALESPROJECT_MILESTONE'"); + break; + case "'SERIALLETTER'": + values.push("'LETTERRECIPIENT'"); + break; + case "'PERSON'": + setAttrCondition = true; + additionalCondition = " or AB_LOGHISTORYID in (" + + newSelect("AB_LOGHISTORYID") + .from("AB_OBJECTRELATION") + .join("AB_LOGHISTORY", "TABLENAMEID = AB_OBJECTRELATIONID") + .join("CONTACT", "(OBJECT1_ROWID = CONTACTID or OBJECT2_ROWID = CONTACTID) and CONTACT.PERSON_ID is not null") + + ")"; + break; + case "'ORGANISATION'": + setAttrCondition = true; + additionalCondition = " or AB_LOGHISTORYID in (" + + newSelect("AB_LOGHISTORYID") + .from("AB_OBJECTRELATION") + .join("AB_LOGHISTORY", "TABLENAMEID = AB_OBJECTRELATIONID") + .join("CONTACT", "(OBJECT1_ROWID = CONTACTID or OBJECT2_ROWID = CONTACTID) and CONTACT.PERSON_ID is null") + + ")"; + + break; + } + + if (setAttrCondition) + { + additionalCondition += " or AB_LOGHISTORYID in (" + + newSelect("AB_LOGHISTORYID") + .from("AB_ATTRIBUTERELATION") + .join("AB_LOGHISTORY", "TABLENAMEID = OBJECT_ROWID and OBJECT_TYPE = " + + values[0].substring(0, 2).toUpperCase() + values[0].substring(2).toLowerCase()) + + ")"; + } + + condition += "(" + values.join(", ") + ")"; + condition += additionalCondition ? additionalCondition : ""; +} + +result.string(condition); \ No newline at end of file diff --git a/entity/AuditLogHistory_entity/recordcontainers/db/filterextensions/contextfilter/filterValuesProcess.js b/entity/AuditLogHistory_entity/recordcontainers/db/filterextensions/contextfilter/filterValuesProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..5b6200428023110675f44b93795dd82f307016d5 --- /dev/null +++ b/entity/AuditLogHistory_entity/recordcontainers/db/filterextensions/contextfilter/filterValuesProcess.js @@ -0,0 +1,18 @@ +import("system.translate"); +import("system.result"); + +result.object( + [ + ["ACTIVITY", translate.text("Activity")], + ["BULKMAIL", translate.text("Bulk mail")], + ["PERSON", translate.text("Contact")], + ["DSGVO", translate.text("DSGVO")], + ["EVENT", translate.text("Event")], + ["ORGANISATION", translate.text("Organisation")], + ["PERSON", translate.text("Person")], + ["SALESORDER", translate.text("Salesorder")], + ["SALESPROJECT", translate.text("Salesproject")], + ["SERIALLETTER", translate.text("Serial letter")], + ["TASK", translate.text("Task")], + ] + ); diff --git a/neonContext/AuditLogHistory/AuditLogHistory.aod b/neonContext/AuditLogHistory/AuditLogHistory.aod new file mode 100644 index 0000000000000000000000000000000000000000..4e735cc63f5130302527b8b873e68b5444cc5b88 --- /dev/null +++ b/neonContext/AuditLogHistory/AuditLogHistory.aod @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.1.1"> + <name>AuditLogHistory</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <filterView>AuditLogHistoryFilter_view</filterView> + <entity>AuditLogHistory_entity</entity> + <references> + <neonViewReference> + <name>c468be91-da18-4c22-abbd-cfa1c410d013</name> + <view>AuditLogHistoryFilter_view</view> + </neonViewReference> + </references> +</neonContext> diff --git a/neonView/AuditLogHistoryFilter_view/AuditLogHistoryFilter_view.aod b/neonView/AuditLogHistoryFilter_view/AuditLogHistoryFilter_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..87d730da51efd42cef56757ad691f7ab84a21e57 --- /dev/null +++ b/neonView/AuditLogHistoryFilter_view/AuditLogHistoryFilter_view.aod @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.6" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.6"> + <name>AuditLogHistoryFilter_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <filterable v="true" /> + <dashletConfigurations> + <neonDashletConfiguration> + <name>AuditDashlet</name> + <title>AuditLogs</title> + <description>Show all audits</description> + <fragment>AuditLogHistory/filter</fragment> + <storeRoles> + <element>INTERNAL_ADMINISTRATOR</element> + <element>INTERNAL_DASHBOARDSTOREADMIN</element> + <element>INTERNAL_DESIGNER</element> + </storeRoles> + <icon>VAADIN:LINES_LIST</icon> + <categories> + <neonDashletCategory> + <name>Admin</name> + <title>Admin</title> + </neonDashletCategory> + </categories> + </neonDashletConfiguration> + </dashletConfigurations> + <layout> + <boxLayout> + <name>layout</name> + </boxLayout> + </layout> + <children> + <timelineViewTemplate> + <name>Timeline</name> + <dateField>DATE_NEW</dateField> + <titleField>PREVIEW_TITLE</titleField> + <descriptionField>DESCRIPTION</descriptionField> + <subdescriptionField>LOGTYPE</subdescriptionField> + <additionalInfoField>USER_NEW</additionalInfoField> + <hideContentSearch v="false" /> + <entityField>#ENTITY</entityField> + <isEditable v="false" /> + <informationField></informationField> + <isCreatable v="false" /> + </timelineViewTemplate> + </children> +</neonView> diff --git a/process/Loghistory_lib/process.js b/process/Loghistory_lib/process.js index 93375b4ee77b833c60aae891fece0bf0f84bca00..00ee5d28afd329d981a2d69ae461414c16e55134 100644 --- a/process/Loghistory_lib/process.js +++ b/process/Loghistory_lib/process.js @@ -250,12 +250,12 @@ LogHistoryExecutor.prototype._addEntryForInsert = function (pTablename, pTablena //the "SOURCE_TABLENAME" and "SOURCE_TABLENAMEID" are reserved for later usage in the change-notification-subscriptions //TODO: check if they are really needed this.toInsert = { statements: [] - ,cols: ["LOGTYPE","TABLENAME","TABLENAMEID","DESCRIPTION", "SOURCE_TABLENAME", "SOURCE_TABLENAMEID", "DATE_NEW","USER_NEW"] + ,cols: ["LOGTYPE","TABLENAME","TABLENAMEID","DESCRIPTION", "SOURCE_TABLENAME", "SOURCE_TABLENAMEID", "DATE_NEW","USER_NEW", "AB_LOGHISTORYID"] }; this.toInsert.types = db.getColumnTypes("AB_LOGHISTORY", this.toInsert.cols);//load only once for better performance } - var vals = [this.sqlAction, pTablename, pTablenameId, pDescription, pSourceTablename, pSourceTablenameId, this.timestamp, this.triggeringUser]; + var vals = [this.sqlAction, pTablename, pTablenameId, pDescription, pSourceTablename, pSourceTablenameId, this.timestamp, this.triggeringUser, util.getNewUUID()]; this.toInsert.statements.push(["AB_LOGHISTORY", this.toInsert.cols, this.toInsert.types, vals]); };