Skip to content
Snippets Groups Projects
Commit b2762c9a authored by m.kuhn's avatar m.kuhn
Browse files

loghistory_lib

parent 8d6414af
No related branches found
No related tags found
No related merge requests found
...@@ -2938,7 +2938,7 @@ ...@@ -2938,7 +2938,7 @@
<description></description> <description></description>
<auditSyncConfig> <auditSyncConfig>
<name>auditSyncConfig</name> <name>auditSyncConfig</name>
<auditMode v="0" /> <auditMode v="1" />
<syncActive v="false" /> <syncActive v="false" />
<syncComplete v="true" /> <syncComplete v="true" />
<syncDirection v="1" /> <syncDirection v="1" />
...@@ -4107,7 +4107,7 @@ ...@@ -4107,7 +4107,7 @@
<description></description> <description></description>
<auditSyncConfig> <auditSyncConfig>
<name>auditSyncConfig</name> <name>auditSyncConfig</name>
<auditMode v="0" /> <auditMode v="1" />
<syncActive v="false" /> <syncActive v="false" />
<syncComplete v="true" /> <syncComplete v="true" />
<syncDirection v="1" /> <syncDirection v="1" />
......
...@@ -618,6 +618,7 @@ ...@@ -618,6 +618,7 @@
<name>LogHistoryConsumer</name> <name>LogHistoryConsumer</name>
<title>LogHistory</title> <title>LogHistory</title>
<fieldType>DEPENDENCY_OUT</fieldType> <fieldType>DEPENDENCY_OUT</fieldType>
<state>READONLY</state>
<dependency> <dependency>
<name>dependency</name> <name>dependency</name>
<entityName>LogHistory_entity</entityName> <entityName>LogHistory_entity</entityName>
......
...@@ -717,6 +717,7 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact ...@@ -717,6 +717,7 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
<name>LogHistoryConsumer</name> <name>LogHistoryConsumer</name>
<title>LogHistory</title> <title>LogHistory</title>
<fieldType>DEPENDENCY_OUT</fieldType> <fieldType>DEPENDENCY_OUT</fieldType>
<state>READONLY</state>
<dependency> <dependency>
<name>dependency</name> <name>dependency</name>
<entityName>LogHistory_entity</entityName> <entityName>LogHistory_entity</entityName>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<preferences xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="3.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/preferences/3.1.0"> <preferences xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="3.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/preferences/3.1.0">
<name>_____PREFERENCES_PROJECT</name> <name>_____PREFERENCES_PROJECT</name>
<majorModelMode>DISTRIBUTED</majorModelMode> <majorModelMode>DISTRIBUTED</majorModelMode>
<projectName>xRM-Basic5</projectName> <projectName>xRM-Basic 2019</projectName>
<jditoMaxContentSize v="57671680" /> <jditoMaxContentSize v="57671680" />
<calendarCategoriesEvent> <calendarCategoriesEvent>
<entry> <entry>
......
import("system.logging");
import("system.project"); import("system.project");
import("system.calendars"); import("system.calendars");
import("system.db"); import("system.db");
...@@ -30,25 +31,27 @@ import("Util_lib"); ...@@ -30,25 +31,27 @@ import("Util_lib");
function logHistory (pTable, pUser, pColumns, pNewValues, pOldValues, pTimeStamp, pAction, pIdValue) function logHistory (pTable, pUser, pColumns, pNewValues, pOldValues, pTimeStamp, pAction, pIdValue)
{ {
var references = {}; var references = {};
var columns = {}; var coldef = {};
var toLog = false; var primaryKey = "";
var tolog = false;
pTable = pTable.toUpperCase(); pTable = pTable.toUpperCase();
pColumns = pColumns.map(function (v){ return v.toUpperCase(); }); pColumns = pColumns.map(function (v){ return v.toUpperCase(); });
var Structure = project.getAliasDefinitionStructure("Data_alias", pTable); var structure = project.getAliasDefinitionStructure("Data_alias", pTable);
if (Structure) if (structure)
{ {
columns = Structure.tables[pTable].columns; coldef = structure.tables[pTable].columns;
for (var column in columns) for (var column in coldef)
{ {
if (columns[column].tableRef != null) references[column] = {table: columns[column].tableRef, id: ""}; if (coldef[column].tableRef) references[column] = {table: coldef[column].tableRef, id: ""};
if (columns[column].primaryKey) primaryKey = column; if (coldef[column].primaryKey) primaryKey = column;
if (columns[column].log) toLog = columns[column].log; if (coldef[column].log) tolog = coldef[column].log;
} }
} }
if (toLog) if (tolog)
{ {
var idvalue = pIdValue; var idvalue = pIdValue;
var description = []; var description = [];
...@@ -103,6 +106,7 @@ function logHistory (pTable, pUser, pColumns, pNewValues, pOldValues, pTimeStamp ...@@ -103,6 +106,7 @@ function logHistory (pTable, pUser, pColumns, pNewValues, pOldValues, pTimeStamp
} //no extra tables } //no extra tables
else else
{ {
logging.log("no extra table");
if (pTable == "ASYS_CALENDARBACKEND") { if (pTable == "ASYS_CALENDARBACKEND") {
var entrytypePosition = pColumns.indexOf("ENTRYTYPE"); var entrytypePosition = pColumns.indexOf("ENTRYTYPE");
if (entrytypePosition > -1) if (pNewValues[entrytypePosition] == calendars.VEVENT) return; if (entrytypePosition > -1) if (pNewValues[entrytypePosition] == calendars.VEVENT) return;
...@@ -155,46 +159,6 @@ function logHistory (pTable, pUser, pColumns, pNewValues, pOldValues, pTimeStamp ...@@ -155,46 +159,6 @@ function logHistory (pTable, pUser, pColumns, pNewValues, pOldValues, pTimeStamp
} }
} }
/*
* Creates an Array of AB_LOGHISTORY data for display in a view
*
* @param {String} pCondition req TableName
*
* @return {[]} table
*/
function showLoghistory(pCondition)
{
var loglist = db.createEmptyTable(3);
var data = db.table("select DATE_NEW, USER_NEW, DESCRIPTION from ASYS_LOGHISTORY where " + pCondition + " order by DATE_NEW desc");
if (data.length > 0)
{
loglist = [];
var groupdate = datetime.toDate(data[0][0], translate.text("dd.MM.yyyy HH:mm"));
var logdate = data[0][0];
var loguser = data[0][1];
var descripton = data[0][2];
for (var i = 1; i < data.length; i++)
{
if (groupdate + loguser == datetime.toDate(data[i][0], translate.text("dd.MM.yyyy HH:mm")) + data[i][1])
{
if (descripton != data[i][2]) descripton = data[i][2] + "\n" + descripton;
}
else
{
loglist.push([logdate, loguser, descripton]);
groupdate = datetime.toDate(data[i][0], translate.text("dd.MM.yyyy HH:mm"));
logdate = data[i][0];
loguser = data[i][1];
descripton = data[i][2];
}
}
loglist.push([logdate, loguser, descripton]);
}
return loglist;
}
/* /*
* Creates the data for the tables with special cases * Creates the data for the tables with special cases
* *
......
import("Loghist_lib"); import("system.logging");
import("Loghistory_lib");
import("system.vars"); import("system.vars");
var tableName = vars.get("$local.table"); var tableName = vars.get("$local.table");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment