From 4feb358990e1c78f8a2c31fb1202b12b699cb5a8 Mon Sep 17 00:00:00 2001
From: "j.goderbauer" <j.goderbauer@adito.de>
Date: Thu, 2 May 2019 13:03:54 +0200
Subject: [PATCH] =?UTF-8?q?[Projekt:=20Entwicklung=20-=20Neon][TicketNr.:?=
 =?UTF-8?q?=201036415][=C3=9Cbernahme=20AUDIT=20und=20Logging=20aus=20best?=
 =?UTF-8?q?ehendem=20xRM-Basic=20f=C3=BCr=20ADITO=202019]=20removed=20unne?=
 =?UTF-8?q?cessary=20db-columns?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../AditoBasic/create_ab_loghistory.xml       |  5 --
 aliasDefinition/Data_alias/Data_alias.aod     | 57 +++----------------
 .../LogHistory_entity/LogHistory_entity.aod   | 36 +-----------
 .../recordcontainers/db/conditionProcess.js   |  7 ---
 .../recordcontainers/db/orderClauseProcess.js |  7 ---
 process/Loghistory_lib/process.js             |  5 +-
 6 files changed, 12 insertions(+), 105 deletions(-)
 delete mode 100644 entity/LogHistory_entity/recordcontainers/db/conditionProcess.js
 delete mode 100644 entity/LogHistory_entity/recordcontainers/db/orderClauseProcess.js

diff --git a/.liquibase/Data_alias/basic/2019.2/AditoBasic/create_ab_loghistory.xml b/.liquibase/Data_alias/basic/2019.2/AditoBasic/create_ab_loghistory.xml
index 730afa8142..16c96add30 100644
--- a/.liquibase/Data_alias/basic/2019.2/AditoBasic/create_ab_loghistory.xml
+++ b/.liquibase/Data_alias/basic/2019.2/AditoBasic/create_ab_loghistory.xml
@@ -2,14 +2,9 @@
 <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.kuhn" id="fbe17fba-5bf7-4203-8f6f-01723e07194c">
         <createTable tableName="AB_LOGHISTORY">
-            <column name="AB_LOGHISTORYID" type="CHAR(36)">
-                <constraints primaryKey="true" primaryKeyName="PK_AB_LOGHISTORY_AB_LOGHISTORYID"/>
-            </column>
-            <column name="USER_EDIT" type="NVARCHAR(50)"/>
             <column name="USER_NEW" type="NVARCHAR(50)">
                 <constraints nullable="false"/>
             </column> 
-            <column name="DATE_EDIT" type="TIMESTAMP"/>
             <column name="DATE_NEW" type="TIMESTAMP">
                 <constraints nullable="false"/>
             </column>          
diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod
index afba8ae9a5..3a15dc43ae 100644
--- a/aliasDefinition/Data_alias/Data_alias.aod
+++ b/aliasDefinition/Data_alias/Data_alias.aod
@@ -8091,20 +8091,6 @@
                 <title>Tablename</title>
                 <description></description>
               </entityFieldDb>
-              <entityFieldDb>
-                <name>DATE_EDIT</name>
-                <dbName></dbName>
-                <primaryKey v="false" />
-                <columnType v="93" />
-                <size v="29" />
-                <scale v="9" />
-                <notNull v="false" />
-                <isUnique v="false" />
-                <index v="false" />
-                <documentation></documentation>
-                <title>Modification date</title>
-                <description></description>
-              </entityFieldDb>
               <entityFieldDb>
                 <name>DESCRIPTION</name>
                 <dbName></dbName>
@@ -8161,20 +8147,6 @@
                 <title>Source tablename</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="false" />
-                <documentation></documentation>
-                <title>Log history Id</title>
-                <description></description>
-              </entityFieldDb>
               <entityFieldDb>
                 <name>TABLENAMEID</name>
                 <dbName></dbName>
@@ -8189,20 +8161,6 @@
                 <title>Tablename Id</title>
                 <description></description>
               </entityFieldDb>
-              <entityFieldDb>
-                <name>DATE_NEW</name>
-                <dbName></dbName>
-                <primaryKey v="false" />
-                <columnType v="93" />
-                <size v="29" />
-                <scale v="9" />
-                <notNull v="true" />
-                <isUnique v="false" />
-                <index v="false" />
-                <documentation></documentation>
-                <title>Creation date</title>
-                <description></description>
-              </entityFieldDb>
               <entityFieldDb>
                 <name>USER_NEW</name>
                 <dbName></dbName>
@@ -8218,15 +8176,18 @@
                 <description></description>
               </entityFieldDb>
               <entityFieldDb>
-                <name>USER_EDIT</name>
+                <name>DATE_NEW</name>
                 <dbName></dbName>
                 <primaryKey v="false" />
-                <columnType v="12" />
-                <size v="50" />
-                <scale v="0" />
-                <notNull v="false" />
+                <columnType v="93" />
+                <size v="29" />
+                <scale v="9" />
+                <notNull v="true" />
                 <isUnique v="false" />
-                <title>Modification user</title>
+                <index v="false" />
+                <documentation></documentation>
+                <title></title>
+                <description></description>
               </entityFieldDb>
             </entityFields>
           </entityDb>
diff --git a/entity/LogHistory_entity/LogHistory_entity.aod b/entity/LogHistory_entity/LogHistory_entity.aod
index 98452a68ce..d47acb82b8 100644
--- a/entity/LogHistory_entity/LogHistory_entity.aod
+++ b/entity/LogHistory_entity/LogHistory_entity.aod
@@ -1,8 +1,8 @@
 <?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.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.3.2">
   <name>LogHistory_entity</name>
-  <title>LogHistory</title>
   <majorModelMode>DISTRIBUTED</majorModelMode>
+  <title>LogHistory</title>
   <iconId>NEON:HISTORY</iconId>
   <imageProcess>%aditoprj%/entity/LogHistory_entity/imageProcess.js</imageProcess>
   <recordContainer>jdito</recordContainer>
@@ -99,40 +99,6 @@
     </entityField>
   </entityFields>
   <recordContainers>
-    <dbRecordContainer>
-      <name>db</name>
-      <title>db</title>
-      <alias>Data_alias</alias>
-      <conditionProcess>%aditoprj%/entity/LogHistory_entity/recordcontainers/db/conditionProcess.js</conditionProcess>
-      <orderClauseProcess>%aditoprj%/entity/LogHistory_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess>
-      <linkInformation>
-        <linkInformation>
-          <name>6becd235-2c53-4ddb-916c-e25da8fc59f5</name>
-          <tableName>AB_LOGHISTORY</tableName>
-          <primaryKey>AB_LOGHISTORYID</primaryKey>
-          <isUIDTable v="true" />
-          <readonly v="false" />
-        </linkInformation>
-      </linkInformation>
-      <recordFieldMappings>
-        <dbRecordFieldMapping>
-          <name>DATE_NEW.value</name>
-          <recordfield>AB_LOGHISTORY.DATE_NEW</recordfield>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>DESCRIPTION.value</name>
-          <recordfield>AB_LOGHISTORY.DESCRIPTION</recordfield>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>LOGHISTORYID.value</name>
-          <recordfield>AB_LOGHISTORY.AB_LOGHISTORYID</recordfield>
-        </dbRecordFieldMapping>
-        <dbRecordFieldMapping>
-          <name>USER_NEW.value</name>
-          <recordfield>AB_LOGHISTORY.USER_NEW</recordfield>
-        </dbRecordFieldMapping>
-      </recordFieldMappings>
-    </dbRecordContainer>
     <jDitoRecordContainer>
       <name>jdito</name>
       <jDitoRecordAlias>Data_alias</jDitoRecordAlias>
diff --git a/entity/LogHistory_entity/recordcontainers/db/conditionProcess.js b/entity/LogHistory_entity/recordcontainers/db/conditionProcess.js
deleted file mode 100644
index 0ada3361d0..0000000000
--- a/entity/LogHistory_entity/recordcontainers/db/conditionProcess.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import("system.vars");
-import("system.result");
-
-var sql = "(TABLENAMEID = '" + vars.get("$param.tablenameId_param") + "' and TABLENAME = '" + vars.get("$param.tablename_param") + "') "
-    + "or (TABLENAMEID = '" + vars.get("$param.contactId_param") + "' "
-    + "and (TABLENAME='CONTACT' or TABLENAME='PERSON' or TABLENAME='COMMUNICATION' or TABLENAME='ADDRESS' or TABLENAME='AB_ATTRIBUTERELATION'))";
-result.string(sql);
\ No newline at end of file
diff --git a/entity/LogHistory_entity/recordcontainers/db/orderClauseProcess.js b/entity/LogHistory_entity/recordcontainers/db/orderClauseProcess.js
deleted file mode 100644
index 7fcae82e96..0000000000
--- a/entity/LogHistory_entity/recordcontainers/db/orderClauseProcess.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import("system.db");
-import("system.result");
-
-result.object({
-    "AB_LOGHISTORY.DATE_NEW": db.DESCENDING,
-    "AB_LOGHISTORY.USER_NEW": db.ASCENDING
-});
\ No newline at end of file
diff --git a/process/Loghistory_lib/process.js b/process/Loghistory_lib/process.js
index 3b5c791ae3..474b568aeb 100644
--- a/process/Loghistory_lib/process.js
+++ b/process/Loghistory_lib/process.js
@@ -238,13 +238,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: ["AB_LOGHISTORYID", "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"]
         };
         this.toInsert.types = db.getColumnTypes("AB_LOGHISTORY", this.toInsert.cols);//load only once for better performance
     }
 
-    var vals = [util.getNewUUID(), this.sqlAction, pTablename, pTablenameId, pDescription, pSourceTablename, pSourceTablenameId, this.timestamp, this.triggeringUser];
+    var vals = [this.sqlAction, pTablename, pTablenameId, pDescription, pSourceTablename, pSourceTablenameId, this.timestamp, this.triggeringUser];
     this.toInsert.statements.push(["AB_LOGHISTORY", this.toInsert.cols, this.toInsert.types, vals]);
 };
 
-- 
GitLab