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

getContextDataSql with state

parent b7ad6b03
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,7 @@ import("system.vars");
import("system.result");
import("Context_lib");
import("system.translate");
import("system.logging");
var resultList = [];
if (vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param") && vars.exists("$param.ObjectRowId_param") && vars.get("$param.ObjectRowId_param"))
......@@ -27,7 +28,7 @@ if (vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param"
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, active));
var data = db.table(ContextUtils.getContextDataSql(context, vars.get("$param.ObjectRowId_param"), true, active, true));
data.forEach(function (row)
{
var 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, undefined)));
result.object(db.table(vars.get("$param.ObjectRowId_param"), ContextUtils.getContextDataSql(vars.get("$param.ObjectType_param"), vars.get("$param.ObjectRowId_param"), false, undefined, false)));
}
else
{
result.object(db.table(ContextUtils.getContextDataSql(vars.get("$param.ObjectType_param"), undefined, false, undefined)))
result.object(db.table(ContextUtils.getContextDataSql(vars.get("$param.ObjectType_param"), undefined, false, undefined, false)))
}
}
else
......
......@@ -293,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, pActive)
ContextUtils.getContextDataSql = function(pContextId, pRowId, pWithDate, pActive, pWithState)
{
var selectMap = ContextUtils._getSelectMap()
var cond = SqlCondition.begin();
......@@ -321,6 +321,10 @@ ContextUtils.getContextDataSql = function(pContextId, pRowId, pWithDate, pActive
var dateColumn = "";
if (pWithDate === true)
dateColumn = ", " + selectMap[pContextId][5];
var stateColumn = "";
if (pWithState === true)
stateColumn = ", " + selectMap[pContextId][7];
return cond.buildSql("select " + selectMap[pContextId][3] + ", " + selectMap[pContextId][0] + dateColumn + " from " + selectMap[pContextId][1] + " " + selectMap[pContextId][2], "1=1");
return cond.buildSql("select " + selectMap[pContextId][3] + ", " + selectMap[pContextId][0] + dateColumn + stateColumn + " 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