Skip to content
Snippets Groups Projects
Commit 62521eca authored by Tobias Feldmann's avatar Tobias Feldmann
Browse files

360 degree with active filter

parent 3aa39a44
No related branches found
No related tags found
No related merge requests found
......@@ -127,6 +127,14 @@
<searchable v="false" />
<valueProcess>%aditoprj%/entity/360Degree_entity/entityfields/icon/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>ACTIVE</name>
<title>Active</title>
<contentType>TEXT</contentType>
<possibleItemsProcess>%aditoprj%/entity/360Degree_entity/entityfields/active/possibleItemsProcess.js</possibleItemsProcess>
<searchable v="true" />
<groupable v="true" />
</entityField>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
......@@ -139,6 +147,7 @@
<element>TARGET_CONTEXT.value</element>
<element>TITLE.value</element>
<element>DATE.value</element>
<element>ACTIVE.value</element>
</recordFields>
</jDitoRecordContainer>
</recordContainers>
......
import("system.vars");
import("system.result");
import("system.translate");
result.object([["true", translate.text("True")], ["false",translate.text("False")]]);
\ No newline at end of file
......@@ -4,14 +4,30 @@ import("system.db");
import("system.vars");
import("system.result");
import("Context_lib");
import("system.translate");
var resultList = [];
if (vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param") && vars.exists("$param.ObjectRowId_param") && vars.get("$param.ObjectRowId_param"))
{
var active;
if(vars.exists("$local.filter") && vars.get("$local.filter") )
{
var filter = JSON.parse(vars.getString("$local.filter"));
if(filter.childs != null && filter.childs.length > 0)
{
filter.childs.forEach(function(child)
{
if(child.name === "ACTIVE")
active = JSON.parse(child.key);
});
}
}
var contextList = JSON.parse(vars.getString("$param.ObjectType_param"));
contextList.forEach(function (context)
{
var data = db.table(ContextUtils.getContextDataSql(context, vars.get("$param.ObjectRowId_param"), true));
var data = db.table(ContextUtils.getContextDataSql(context, vars.get("$param.ObjectRowId_param"), true, active));
data.forEach(function (row)
{
var record = [];
......@@ -20,6 +36,11 @@ if (vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param"
record[2] = context; // TARGET_CONTEXT
record[3] = row[1]; // TITLE
record[4] = row[2]; //DATE
if(active != undefined)
record[5] = translate.text(active); //ACTIVE
else
record[5] = ""; //ACTIVE
resultList.push(record);
});
......
......@@ -7,11 +7,11 @@ if (vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param"
{
if (vars.exists("$param.ObjectRowId_param") && vars.get("$param.ObjectRowId_param"))
{
result.object(db.table(vars.get("$param.ObjectRowId_param"), ContextUtils.getContextDataSql(vars.get("$param.ObjectType_param"), vars.get("$param.ObjectRowId_param"), false)));
result.object(db.table(vars.get("$param.ObjectRowId_param"), ContextUtils.getContextDataSql(vars.get("$param.ObjectType_param"), vars.get("$param.ObjectRowId_param"), false, undefined)));
}
else
{
result.object(db.table(ContextUtils.getContextDataSql(vars.get("$param.ObjectType_param"), undefined, false)))
result.object(db.table(ContextUtils.getContextDataSql(vars.get("$param.ObjectType_param"), undefined, false, undefined)))
}
}
else
......
......@@ -1038,6 +1038,10 @@
<key>responsible</key>
<value>verantwortlich</value>
</entry>
<entry>
<key>False</key>
<value>Nein</value>
</entry>
<entry>
<key>Show all Facebook posts of a user</key>
<value>Alle Facebook Beiträge eines Benutzers anzeigen</value>
......@@ -3231,6 +3235,10 @@
<entry>
<key>Bestätigt</key>
</entry>
<entry>
<key>True</key>
<value>Ja</value>
</entry>
<entry>
<key>Vorläufig</key>
</entry>
......
......@@ -5,6 +5,7 @@ import("system.SQLTYPES");
import("Keyword_lib");
import("Sql_lib");
import("Contact_lib");
import("system.logging");
/**
* Methods to manage contexts.
......@@ -108,16 +109,17 @@ ContextUtils._getSelectMap = function()
{
var maskingUtils = new SqlMaskingUtils();
return {
// contextId: [
// nameField, 0
// Tablename, 1
// contextId,
// nameField, 0
// Tablename 1
// joins (if needed), 2
// IDField, 3
// RelationField, 4
// CreationDate, 5
// CreationDate 5
// override Tablename (needed if Tablename is a join clause) 6
// ]
//
// StateField 7
// Active States 8
// "Appointment": ["SUMMARY", "ASYS_CALENDARBACKEND", "UID"]
"Organisation": [
"\"NAME\"",
......@@ -125,7 +127,10 @@ ContextUtils._getSelectMap = function()
"",
"ORGANISATIONID",
"",
""
"",
"",
"",
[]
],
"Person": [
(new ContactTitleRenderer(Contact.createWithColumnPreset()).asSql()),
......@@ -134,7 +139,9 @@ ContextUtils._getSelectMap = function()
"CONTACTID",
"CONTACT",
"",
"CONTACT"
"CONTACT",
"",
[]
],
"Activity": [
"SUBJECT",
......@@ -142,7 +149,10 @@ ContextUtils._getSelectMap = function()
"",
"ACTIVITYID",
"",
""
"",
"",
"",
[]
],
"Salesproject": [
maskingUtils.concat([
......@@ -156,7 +166,10 @@ ContextUtils._getSelectMap = function()
"",
"SALESPROJECTID",
"CONTACT_ID",
"STARTDATE"
"STARTDATE",
"",
"STATE",
["25b0ac77-ef92-4809-802e-bb9d8782f865", "23d38486-4cce-41ce-a8df-164ad44df706"]
],
"Contract": [
maskingUtils.concat([
......@@ -167,7 +180,10 @@ ContextUtils._getSelectMap = function()
"",
"CONTRACTID",
"CONTACT_ID",
"CONTRACTSTART"
"CONTRACTSTART",
"",
"CONTRACTSTATUS",
["e12d37e9-3429-40b5-973b-c1569843ca46", "3579eb0c-d8ca-4b6b-85ee-f1800a9301eb", "4c63c82d-0276-4c12-9937-13fd361ad786"]
],
"Offer": [
maskingUtils.concat([
......@@ -181,7 +197,10 @@ ContextUtils._getSelectMap = function()
"",
"OFFERID",
"CONTACT_ID",
"OFFERDATE"
"OFFERDATE",
"",
"STATUS",
["5134153d-2e18-452f-ab35-7a52f1aee7d1", "e5d6b5a4-7576-440f-8332-bc40147c0335"]
],
"Order": [
maskingUtils.concat([
......@@ -195,7 +214,10 @@ ContextUtils._getSelectMap = function()
"",
"SALESORDERID",
"CONTACT_ID",
"ORDERDATE"
"ORDERDATE",
"",
"",
[]
],
"Product": [
maskingUtils.concat([
......@@ -207,7 +229,10 @@ ContextUtils._getSelectMap = function()
"",
"PRODUCTID",
"",
""
"",
"",
"",
[]
],
"Task": [
"SUBJECT",
......@@ -216,7 +241,9 @@ ContextUtils._getSelectMap = function()
"TASKID",
translate.text("Task"),
"",
""
"",
"",
[]
]
}
}
......@@ -266,7 +293,7 @@ ContextUtils.getNameSql = function(pContextId, pRowId)
/**
* TODO: !!!temporary function until you can get fields from another Entity!!!
*/
ContextUtils.getContextDataSql = function(pContextId, pRowId, pWithDate)
ContextUtils.getContextDataSql = function(pContextId, pRowId, pWithDate, pActive)
{
var selectMap = ContextUtils._getSelectMap()
var cond = SqlCondition.begin();
......@@ -274,10 +301,26 @@ ContextUtils.getContextDataSql = function(pContextId, pRowId, pWithDate)
{
cond.andPrepare(selectMap[pContextId][1] + "." + selectMap[pContextId][4], pRowId)
}
if (pActive != undefined)
{
var activeStates = selectMap[pContextId][8]
if(activeStates != null && activeStates.length > 0)
{
var condSub = SqlCondition.begin();
activeStates.forEach(function (state)
{
if(pActive)
condSub.orPrepare(selectMap[pContextId][1] + "." + selectMap[pContextId][7], state)
else
condSub.andPrepare(selectMap[pContextId][1] + "." + selectMap[pContextId][7], state, "# != ?")
});
cond.andSqlCondition(condSub);
}
}
var dateColumn = "";
if (pWithDate === true)
dateColumn = ", " + selectMap[pContextId][6];
dateColumn = ", " + selectMap[pContextId][5];
return cond.buildSql("select " + selectMap[pContextId][3] + ", " + selectMap[pContextId][0] + dateColumn + " from " + selectMap[pContextId][1] + " " + selectMap[pContextId][2], "1=1");
}
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