Skip to content
Snippets Groups Projects
Commit 0255822c authored by Sebastian Pongratz's avatar Sebastian Pongratz :ping_pong:
Browse files

[Projekt: xRM-ContactManagement][TicketNr.: 2001570][Dashlet ToDo zeigt falsche/keine Aufgaben an]

parent 832b28dd
No related branches found
No related tags found
No related merge requests found
import("Employee_lib"); import("Employee_lib");
import("system.db");
import("system.result"); import("system.result");
import("Sql_lib"); import("Sql_lib");
import("KeywordRegistry_basic"); import("KeywordRegistry_basic");
var contactId = EmployeeUtils.getCurrentContactId();
var departmentId = EmployeeUtils.getUsersDepartment(contactId, false);
var opentask = newSelect("count(TASKID)") var opentask = newSelect("count(TASKID)")
.from("TASK") .from("TASK")
.where("TASK.STATUS", $KeywordRegistry.taskStatus$new()) .join("TASKATTENDEES","TASKATTENDEES.TASK_ID = TASK.TASKID")
.and ("TASK.KIND", "TASK") .where(
.and("TASK.EDITOR_CONTACT_ID", EmployeeUtils.getCurrentContactId()) newWhere("TASKATTENDEES.CONTACT_ID", contactId)
.cell(); .or("TASKATTENDEES.DEPARTMENT_ID",departmentId)
)
.and("TASK.STATUS", $KeywordRegistry.taskStatus$new())
.cell();
result.string(opentask || 0); result.string(opentask || 0);
\ No newline at end of file
...@@ -4,10 +4,17 @@ import("Sql_lib"); ...@@ -4,10 +4,17 @@ import("Sql_lib");
import("Employee_lib"); import("Employee_lib");
import("system.neon"); import("system.neon");
var contactId = EmployeeUtils.getCurrentContactId();
var departmentId = EmployeeUtils.getUsersDepartment(contactId, false);
var taskIds = newSelect("TASKID") var taskIds = newSelect("TASKID")
.from("TASK") .from("TASK")
.where("TASK.STATUS", $KeywordRegistry.taskStatus$new()) .join("TASKATTENDEES","TASKATTENDEES.TASK_ID = TASK.TASKID")
.and("TASK.EDITOR_CONTACT_ID", EmployeeUtils.getCurrentContactId()) .where(
newWhere("TASKATTENDEES.CONTACT_ID", contactId)
.or("TASKATTENDEES.DEPARTMENT_ID", departmentId)
)
.and("TASK.STATUS", $KeywordRegistry.taskStatus$new())
.arrayColumn(); .arrayColumn();
var recipe = neonFilter.createEntityRecordsRecipeBuilder().uidsIncludelist(taskIds).toString(); var recipe = neonFilter.createEntityRecordsRecipeBuilder().uidsIncludelist(taskIds).toString();
......
import("system.neonFilter"); import("system.neonFilter");
import("system.neon"); import("system.neon");
import("system.db");
import("ActivityTask_lib"); import("ActivityTask_lib");
import("Employee_lib"); import("Employee_lib");
import("system.vars"); import("system.vars");
import("Sql_lib"); import("Sql_lib");
var contactId = EmployeeUtils.getCurrentContactId();
var departmentId = EmployeeUtils.getUsersDepartment(contactId, false);
var overdueTask = newSelect("TASKID") var overdueTask = newSelect("TASKID")
.from("TASK") .from("TASK")
.where("TASK.MATURITY_DATE", "$sys.date", SqlBuilder.LESS()) .join("TASKATTENDEES","TASKATTENDEES.TASK_ID = TASK.TASKID")
.and("TASK.EDITOR_CONTACT_ID", EmployeeUtils.getCurrentContactId()) .where(
newWhere("TASKATTENDEES.CONTACT_ID", contactId)
.or("TASKATTENDEES.DEPARTMENT_ID",departmentId)
)
.and("TASK.MATURITY_DATE", "$sys.date", SqlBuilder.LESS())
.and("TASK.STATUS", TaskUtils.getEndedStatuses(), SqlBuilder.NOT_IN()) .and("TASK.STATUS", TaskUtils.getEndedStatuses(), SqlBuilder.NOT_IN())
.array(db.COLUMN) .arrayColumn();
var recipe = neonFilter.createEntityRecordsRecipeBuilder().uidsIncludelist(overdueTask).toString(); var recipe = neonFilter.createEntityRecordsRecipeBuilder().uidsIncludelist(overdueTask).toString();
neon.openContextWithRecipe("Task", "TaskFilter_view", recipe, neon.OPERATINGSTATE_SEARCH); neon.openContextWithRecipe("Task", "TaskFilter_view", recipe, neon.OPERATINGSTATE_SEARCH);
import("system.vars"); import("system.result");
import("system.neon");
import("ActivityTask_lib");
import("Employee_lib"); import("Employee_lib");
import("system.vars");
import("Sql_lib"); import("Sql_lib");
import("ActivityTask_lib");
import("system.result"); var contactId = EmployeeUtils.getCurrentContactId();
var departmentId = EmployeeUtils.getUsersDepartment(contactId, false);
var overdueTaskCount = newSelect("count(TASKID)") var overdueTaskCount = newSelect("count(TASKID)")
.from("TASK") .from("TASK")
.where("TASK.MATURITY_DATE", "$sys.date", SqlBuilder.LESS()) .join("TASKATTENDEES","TASKATTENDEES.TASK_ID = TASK.TASKID")
.and ("TASK.KIND", "TASK") .where(
.and("TASK.EDITOR_CONTACT_ID", EmployeeUtils.getCurrentContactId()) newWhere("TASKATTENDEES.CONTACT_ID", contactId)
.or("TASKATTENDEES.DEPARTMENT_ID",departmentId)
)
.and("TASK.MATURITY_DATE", vars.get("$sys.date"), SqlBuilder.LESS())
.and("TASK.STATUS", TaskUtils.getEndedStatuses(), SqlBuilder.NOT_IN()) .and("TASK.STATUS", TaskUtils.getEndedStatuses(), SqlBuilder.NOT_IN())
.cell() .cell();
result.string(overdueTaskCount); result.string(overdueTaskCount);
\ No newline at end of file
...@@ -490,7 +490,7 @@ ...@@ -490,7 +490,7 @@
</entityField> </entityField>
<entityField> <entityField>
<name>connections</name> <name>connections</name>
<title>Verknuepfungen</title> <title>Connections</title>
</entityField> </entityField>
<entityField> <entityField>
<name>DATE_EDIT</name> <name>DATE_EDIT</name>
......
...@@ -24,7 +24,7 @@ oldTasks.forEach(function (pTask) { ...@@ -24,7 +24,7 @@ oldTasks.forEach(function (pTask) {
logging.log(text.text2html(pTask[0], true)); logging.log(text.text2html(pTask[0], true));
statements.push(newWhereIfSet("TASK.TASKID", pTask[1]) statements.push(newWhereIfSet("TASK.TASKID", pTask[1])
.buildUpdateStatement({ .buildUpdateStatement({
"TASK.DESCRIPTION" : text.text2html(pTask[0], true) "DESCRIPTION" : text.text2html(pTask[0], true)
}, "TASK")); }, "TASK"));
statements.push(new SqlBuilder().buildInsertStatement({ statements.push(new SqlBuilder().buildInsertStatement({
......
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