From e05a8430754f00daa929e0bfe3322638fec43fa9 Mon Sep 17 00:00:00 2001 From: Tobias Feldmann <t.feldmann@adito.de> Date: Thu, 28 Mar 2019 08:54:05 +0100 Subject: [PATCH] getContextDataSql with state --- .../recordcontainers/jdito/contentProcess.js | 3 ++- .../recordcontainers/jdito/contentProcess.js | 4 ++-- process/Context_lib/process.js | 8 ++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js b/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js index d1f2147962c..2bb99764fd7 100644 --- a/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/360Degree_entity/recordcontainers/jdito/contentProcess.js @@ -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 = []; diff --git a/entity/Object_entity/recordcontainers/jdito/contentProcess.js b/entity/Object_entity/recordcontainers/jdito/contentProcess.js index 8e68adce995..4c8e5d685bc 100644 --- a/entity/Object_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Object_entity/recordcontainers/jdito/contentProcess.js @@ -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 diff --git a/process/Context_lib/process.js b/process/Context_lib/process.js index 92e265493f2..b8034c7952e 100644 --- a/process/Context_lib/process.js +++ b/process/Context_lib/process.js @@ -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"); } -- GitLab