diff --git a/entity/Activity_entity/recordcontainers/db/conditionProcess.js b/entity/Activity_entity/recordcontainers/db/conditionProcess.js index 2d7d8e58d07b4b7a4e5eead6f8528736d4eade6f..c3afc35018132f81d6ec3e3d82a081ad5c539595 100644 --- a/entity/Activity_entity/recordcontainers/db/conditionProcess.js +++ b/entity/Activity_entity/recordcontainers/db/conditionProcess.js @@ -1,8 +1,10 @@ +import("Employee_lib"); import("system.vars"); import("system.db"); import("system.result"); import("Sql_lib"); +var loadNothing = false; var cond = new SqlCondition(); if (vars.exists("$param.RowId_param") && vars.get("$param.RowId_param") && vars.exists("$param.ObjectId_param") && vars.get("$param.ObjectId_param")) { @@ -24,10 +26,22 @@ if (vars.exists("$param.RowId_param") && vars.get("$param.RowId_param") && vars. cond.and(db.translateStatement(activityLinkCond.buildSql("ACTIVITY.ACTIVITYID in (select ACTIVITYLINK.ACTIVITY_ID from ACTIVITYLINK", "1=2", ")"))) } -if(vars.exists("$param.OnlyInnate_param") && vars.get("$param.OnlyInnate_param")) { - cond.andPrepare("ACTIVITY.RESPONSIBLE", vars.get("$sys.user")); +if(vars.getString("$param.OnlyInnate_param") == "true") +{ + var ownContactId = EmployeeUtils.getCurrentContactId(); + if (ownContactId) + cond.andPrepareIfSet("ACTIVITY.RESPONSIBLE", ownContactId); + else + loadNothing = true; } -//TODO: use a preparedCondition when available #1030812 #1034026 -var resCond = db.translateCondition(cond.build("1 = 1")); -result.string(resCond); +if (loadNothing) +{ + resCond = "1 = 2"; +} +else +{ + //TODO: use a preparedCondition when available #1030812 #1034026 + var resCond = db.translateCondition(cond.build("1 = 1")); +} +result.string(resCond); \ No newline at end of file