From 69be15b6c311e7b0cb7c9e4ece566d94be88fbed Mon Sep 17 00:00:00 2001 From: "S.Listl" <S.Listl@SLISTL.aditosoftware.local> Date: Wed, 26 Feb 2020 14:37:12 +0000 Subject: [PATCH] WorkflowTask and WorkflowInstance improved (cherry picked from commit 60a6486f83fa162e5bf921ee4868c8b22ee23978) --- entity/Employee_entity/Employee_entity.aod | 13 ++- .../ObjectProxy_entity/ObjectProxy_entity.aod | 2 +- .../WorkflowDefinition_entity.aod | 1 + .../WorkflowInstance_entity.aod | 45 +++++++++- .../contentTitleProcess.js | 4 + .../includeservicetasks_param/valueProcess.js | 3 + .../workflowinstanceid_param/valueProcess.js | 4 + .../entityfields/key/stateProcess.js | 8 ++ .../workflowinstanceid_param/valueProcess.js | 4 + .../toggleactive/iconIdProcess.js | 5 ++ .../toggleactive/onActionProcess.js | 9 ++ .../entityfields/toggleactive/titleProcess.js | 6 ++ .../recordcontainers/jdito/contentProcess.js | 1 + .../recordcontainers/jdito/onInsert.js | 8 +- .../recordcontainers/jdito/onUpdate.js | 19 +++++ .../WorkflowTask_entity.aod | 65 ++++++++++++++ .../entityfields/claimtask/stateProcess.js | 2 +- .../completetask/onActionProcess.js | 5 +- .../entityfields/completetask/stateProcess.js | 8 +- .../onlyfinishedtasks_param/valueProcess.js | 3 + .../entityfields/icon/colorProcess.js | 6 ++ .../processinstance_id/displayValueProcess.js | 7 ++ .../WorkflowTask_entity/grantUpdateProcess.js | 2 +- entity/WorkflowTask_entity/imageProcess.js | 4 + .../recordcontainers/jdito/contentProcess.js | 84 +++++++++++++------ .../_____LANGUAGE_EXTRA.aod | 9 ++ .../_____LANGUAGE_de/_____LANGUAGE_de.aod | 12 +++ .../_____LANGUAGE_en/_____LANGUAGE_en.aod | 10 +++ neonContext/WorkflowTask/WorkflowTask.aod | 9 +- .../WorkflowInstanceEdit_view.aod | 4 + .../WorkflowInstanceFilter_view.aod | 4 +- .../WorkflowInstancePreview_view.aod | 14 +++- .../WorkflowTaskFilter_view.aod | 5 ++ .../WorkflowTaskFinishedList_view.aod | 20 +++++ .../WorkflowTaskForm_view.aod | 1 + .../WorkflowTaskList_view.aod | 20 +++++ .../WorkflowTaskOwn_view.aod | 5 ++ .../WorkflowTaskPreview_view.aod | 3 +- 38 files changed, 390 insertions(+), 44 deletions(-) create mode 100644 entity/WorkflowInstance_entity/contentTitleProcess.js create mode 100644 entity/WorkflowInstance_entity/entityfields/finishedtasks/children/includeservicetasks_param/valueProcess.js create mode 100644 entity/WorkflowInstance_entity/entityfields/finishedtasks/children/workflowinstanceid_param/valueProcess.js create mode 100644 entity/WorkflowInstance_entity/entityfields/key/stateProcess.js create mode 100644 entity/WorkflowInstance_entity/entityfields/tasks/children/workflowinstanceid_param/valueProcess.js create mode 100644 entity/WorkflowInstance_entity/entityfields/toggleactive/iconIdProcess.js create mode 100644 entity/WorkflowInstance_entity/entityfields/toggleactive/onActionProcess.js create mode 100644 entity/WorkflowInstance_entity/entityfields/toggleactive/titleProcess.js create mode 100644 entity/WorkflowInstance_entity/recordcontainers/jdito/onUpdate.js create mode 100644 entity/WorkflowTask_entity/entityfields/finishedinstancetasks/children/onlyfinishedtasks_param/valueProcess.js create mode 100644 entity/WorkflowTask_entity/entityfields/icon/colorProcess.js create mode 100644 entity/WorkflowTask_entity/entityfields/processinstance_id/displayValueProcess.js create mode 100644 entity/WorkflowTask_entity/imageProcess.js create mode 100644 neonView/WorkflowTaskFinishedList_view/WorkflowTaskFinishedList_view.aod create mode 100644 neonView/WorkflowTaskList_view/WorkflowTaskList_view.aod diff --git a/entity/Employee_entity/Employee_entity.aod b/entity/Employee_entity/Employee_entity.aod index f288645107..02dd23fc47 100644 --- a/entity/Employee_entity/Employee_entity.aod +++ b/entity/Employee_entity/Employee_entity.aod @@ -315,10 +315,21 @@ </entityField> <entityProvider> <name>EmployeesByUserId</name> + <dependencies> + <entityDependency> + <name>1d000ca2-f27e-47d2-95e2-ee14771c4ced</name> + <entityName>WorkflowTask_entity</entityName> + <fieldName>Employees</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> + </entityProvider> + <entityProvider> + <name>EmployeesByShortUserId</name> <lookupIdfield>SHORT_UID</lookupIdfield> <dependencies> <entityDependency> - <name>2b6d7d96-365d-44a0-a457-4d7a08ae18a5</name> + <name>8b02831c-e831-4314-8ea3-d913c3394db2</name> <entityName>ObjectProxy_entity</entityName> <fieldName>Employees</fieldName> <isConsumer v="false" /> diff --git a/entity/ObjectProxy_entity/ObjectProxy_entity.aod b/entity/ObjectProxy_entity/ObjectProxy_entity.aod index a3a700d304..7fc3414239 100644 --- a/entity/ObjectProxy_entity/ObjectProxy_entity.aod +++ b/entity/ObjectProxy_entity/ObjectProxy_entity.aod @@ -144,7 +144,7 @@ <dependency> <name>dependency</name> <entityName>Employee_entity</entityName> - <fieldName>EmployeesByUserId</fieldName> + <fieldName>EmployeesByShortUserId</fieldName> </dependency> </entityConsumer> <entityConsumer> diff --git a/entity/WorkflowDefinition_entity/WorkflowDefinition_entity.aod b/entity/WorkflowDefinition_entity/WorkflowDefinition_entity.aod index 7a08e14542..af9fd22b98 100644 --- a/entity/WorkflowDefinition_entity/WorkflowDefinition_entity.aod +++ b/entity/WorkflowDefinition_entity/WorkflowDefinition_entity.aod @@ -55,6 +55,7 @@ </entityField> <entityConsumer> <name>Instances</name> + <selectionMode>MULTI</selectionMode> <dependency> <name>dependency</name> <entityName>WorkflowInstance_entity</entityName> diff --git a/entity/WorkflowInstance_entity/WorkflowInstance_entity.aod b/entity/WorkflowInstance_entity/WorkflowInstance_entity.aod index 26156dbf3d..f07f8f2577 100644 --- a/entity/WorkflowInstance_entity/WorkflowInstance_entity.aod +++ b/entity/WorkflowInstance_entity/WorkflowInstance_entity.aod @@ -3,7 +3,7 @@ <name>WorkflowInstance_entity</name> <majorModelMode>DISTRIBUTED</majorModelMode> <title>Workflow instance</title> - <grantUpdate v="false" /> + <contentTitleProcess>%aditoprj%/entity/WorkflowInstance_entity/contentTitleProcess.js</contentTitleProcess> <titlePlural>Workflow instances</titlePlural> <recordContainer>jdito</recordContainer> <entityFields> @@ -34,6 +34,7 @@ <title>Key</title> <consumer>WorkflowDefinitions</consumer> <mandatory v="true" /> + <stateProcess>%aditoprj%/entity/WorkflowInstance_entity/entityfields/key/stateProcess.js</stateProcess> </entityField> <entityField> <name>ISACTIVE</name> @@ -44,11 +45,13 @@ <entityField> <name>PROCESSDEFINITION_ID</name> <title>Workflow definition</title> + <state>READONLY</state> </entityField> <entityField> <name>START_TIME</name> <title>Start date</title> <contentType>DATE</contentType> + <state>READONLY</state> </entityField> <entityParameter> <name>WorkflowDefinitionKey_param</name> @@ -66,6 +69,7 @@ <entityField> <name>PROCESSDEFINITION_VERSION</name> <title>Version</title> + <state>READONLY</state> </entityField> <entityField> <name>PROCESSVARIABLES</name> @@ -75,7 +79,14 @@ <dependency> <name>dependency</name> <entityName>WorkflowTask_entity</entityName> + <fieldName>InstanceTasks</fieldName> </dependency> + <children> + <entityParameter> + <name>WorkflowInstanceId_param</name> + <valueProcess>%aditoprj%/entity/WorkflowInstance_entity/entityfields/tasks/children/workflowinstanceid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> </entityConsumer> <entityConsumer> <name>WorkflowDefinitions</name> @@ -97,7 +108,7 @@ </entityParameter> <entityField> <name>NAME</name> - <title>Process</title> + <title>Name</title> </entityField> <entityField> <name>STARTUSER_ID</name> @@ -110,6 +121,32 @@ <name>TargetIdFilter_param</name> <expose v="true" /> </entityParameter> + <entityActionField> + <name>toggleActive</name> + <title>${WORKFLOW_SUSPEND}</title> + <onActionProcess>%aditoprj%/entity/WorkflowInstance_entity/entityfields/toggleactive/onActionProcess.js</onActionProcess> + <iconId>VAADIN:PAUSE</iconId> + <iconIdProcess>%aditoprj%/entity/WorkflowInstance_entity/entityfields/toggleactive/iconIdProcess.js</iconIdProcess> + <titleProcess>%aditoprj%/entity/WorkflowInstance_entity/entityfields/toggleactive/titleProcess.js</titleProcess> + </entityActionField> + <entityConsumer> + <name>FinishedTasks</name> + <dependency> + <name>dependency</name> + <entityName>WorkflowTask_entity</entityName> + <fieldName>FinishedInstanceTasks</fieldName> + </dependency> + <children> + <entityParameter> + <name>WorkflowInstanceId_param</name> + <valueProcess>%aditoprj%/entity/WorkflowInstance_entity/entityfields/finishedtasks/children/workflowinstanceid_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>IncludeServiceTasks_param</name> + <valueProcess>%aditoprj%/entity/WorkflowInstance_entity/entityfields/finishedtasks/children/includeservicetasks_param/valueProcess.js</valueProcess> + </entityParameter> + </children> + </entityConsumer> </entityFields> <recordContainers> <jDitoRecordContainer> @@ -118,11 +155,15 @@ <isSortable v="true" /> <contentProcess>%aditoprj%/entity/WorkflowInstance_entity/recordcontainers/jdito/contentProcess.js</contentProcess> <onInsert>%aditoprj%/entity/WorkflowInstance_entity/recordcontainers/jdito/onInsert.js</onInsert> + <onUpdate>%aditoprj%/entity/WorkflowInstance_entity/recordcontainers/jdito/onUpdate.js</onUpdate> <onDelete>%aditoprj%/entity/WorkflowInstance_entity/recordcontainers/jdito/onDelete.js</onDelete> <recordFieldMappings> <jDitoRecordFieldMapping> <name>UID.value</name> </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>NAME.value</name> + </jDitoRecordFieldMapping> <jDitoRecordFieldMapping> <name>KEY.value</name> </jDitoRecordFieldMapping> diff --git a/entity/WorkflowInstance_entity/contentTitleProcess.js b/entity/WorkflowInstance_entity/contentTitleProcess.js new file mode 100644 index 0000000000..28fd67de27 --- /dev/null +++ b/entity/WorkflowInstance_entity/contentTitleProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.NAME")); \ No newline at end of file diff --git a/entity/WorkflowInstance_entity/entityfields/finishedtasks/children/includeservicetasks_param/valueProcess.js b/entity/WorkflowInstance_entity/entityfields/finishedtasks/children/includeservicetasks_param/valueProcess.js new file mode 100644 index 0000000000..40effa0178 --- /dev/null +++ b/entity/WorkflowInstance_entity/entityfields/finishedtasks/children/includeservicetasks_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string(true); \ No newline at end of file diff --git a/entity/WorkflowInstance_entity/entityfields/finishedtasks/children/workflowinstanceid_param/valueProcess.js b/entity/WorkflowInstance_entity/entityfields/finishedtasks/children/workflowinstanceid_param/valueProcess.js new file mode 100644 index 0000000000..16c85500b5 --- /dev/null +++ b/entity/WorkflowInstance_entity/entityfields/finishedtasks/children/workflowinstanceid_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.UID")); \ No newline at end of file diff --git a/entity/WorkflowInstance_entity/entityfields/key/stateProcess.js b/entity/WorkflowInstance_entity/entityfields/key/stateProcess.js new file mode 100644 index 0000000000..c46bde21b6 --- /dev/null +++ b/entity/WorkflowInstance_entity/entityfields/key/stateProcess.js @@ -0,0 +1,8 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +result.string(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW + ? neon.COMPONENTSTATE_EDITABLE + : neon.COMPONENTSTATE_READONLY +); diff --git a/entity/WorkflowInstance_entity/entityfields/tasks/children/workflowinstanceid_param/valueProcess.js b/entity/WorkflowInstance_entity/entityfields/tasks/children/workflowinstanceid_param/valueProcess.js new file mode 100644 index 0000000000..16c85500b5 --- /dev/null +++ b/entity/WorkflowInstance_entity/entityfields/tasks/children/workflowinstanceid_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.UID")); \ No newline at end of file diff --git a/entity/WorkflowInstance_entity/entityfields/toggleactive/iconIdProcess.js b/entity/WorkflowInstance_entity/entityfields/toggleactive/iconIdProcess.js new file mode 100644 index 0000000000..df6997e15c --- /dev/null +++ b/entity/WorkflowInstance_entity/entityfields/toggleactive/iconIdProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("system.result"); + +if (vars.get("$field.ISACTIVE") != "true") + result.string("VAADIN:PLAY"); \ No newline at end of file diff --git a/entity/WorkflowInstance_entity/entityfields/toggleactive/onActionProcess.js b/entity/WorkflowInstance_entity/entityfields/toggleactive/onActionProcess.js new file mode 100644 index 0000000000..69968d3ecc --- /dev/null +++ b/entity/WorkflowInstance_entity/entityfields/toggleactive/onActionProcess.js @@ -0,0 +1,9 @@ +import("system.logging"); +import("system.neon"); +import("system.workflow"); +import("system.vars"); + +logging.log(workflow.getFinishedActivities(vars.get("$field.UID"))) + +//workflow.setProcessInstanceActive(vars.get("$field.UID"), vars.get("$field.ISACTIVE") != "true"); +//neon.refreshAll(); \ No newline at end of file diff --git a/entity/WorkflowInstance_entity/entityfields/toggleactive/titleProcess.js b/entity/WorkflowInstance_entity/entityfields/toggleactive/titleProcess.js new file mode 100644 index 0000000000..1190b49c80 --- /dev/null +++ b/entity/WorkflowInstance_entity/entityfields/toggleactive/titleProcess.js @@ -0,0 +1,6 @@ +import("system.translate"); +import("system.vars"); +import("system.result"); + +if (vars.get("$field.ISACTIVE") != "true") + result.string(translate.text("Resume")); \ No newline at end of file diff --git a/entity/WorkflowInstance_entity/recordcontainers/jdito/contentProcess.js b/entity/WorkflowInstance_entity/recordcontainers/jdito/contentProcess.js index fa6930da97..d00f8a1e0f 100644 --- a/entity/WorkflowInstance_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/WorkflowInstance_entity/recordcontainers/jdito/contentProcess.js @@ -49,6 +49,7 @@ wfInstances = wfInstances.map(function (instance) { return [ instance.id, + instance.name || instance.processDefinitionName, instance.key, instance.active, instance.processDefinitionId, diff --git a/entity/WorkflowInstance_entity/recordcontainers/jdito/onInsert.js b/entity/WorkflowInstance_entity/recordcontainers/jdito/onInsert.js index 0c2f12489a..3975809ce4 100644 --- a/entity/WorkflowInstance_entity/recordcontainers/jdito/onInsert.js +++ b/entity/WorkflowInstance_entity/recordcontainers/jdito/onInsert.js @@ -8,7 +8,9 @@ import("system.process"); var variables = JSON.parse(vars.getString("$param.ProcessVariables_param")); var targetIdFilter = vars.get("$param.TargetIdFilter_param") ? JSON.parse(vars.getString("$param.TargetIdFilter_param")) : null; -var processKey = vars.get("$local.rowdata")["KEY.value"]; +var rowdata = vars.get("$local.rowdata"); +var processKey = rowdata["KEY.value"]; +var instanceName = rowdata["NAME.value"]; if (Array.isArray(variables.targetId) && variables.targetId.length > 0) _startForIds(variables.targetId.slice(), variables); @@ -46,7 +48,9 @@ function _startForIds (pTargetIds, pVariables) pTargetIds.forEach(function (id) { pVariables.targetId = id; - workflow.startProcessByKey(processKey, pVariables); + var instanceId = workflow.startProcessByKey(processKey, pVariables); + if (instanceName) + workflow.setProcessInstanceName(instanceId, instanceName); }); } diff --git a/entity/WorkflowInstance_entity/recordcontainers/jdito/onUpdate.js b/entity/WorkflowInstance_entity/recordcontainers/jdito/onUpdate.js new file mode 100644 index 0000000000..5d6495cb65 --- /dev/null +++ b/entity/WorkflowInstance_entity/recordcontainers/jdito/onUpdate.js @@ -0,0 +1,19 @@ +import("system.vars"); +import("system.workflow"); + +var processInstanceId = vars.get("$local.uid"); +var rowdata = vars.get("$local.rowdata"); +vars.get("$local.changed").forEach(function (field) +{ + var value = rowdata[field]; + switch (field) + { + case "NAME.value": + if (value) + workflow.setProcessInstanceName(processInstanceId, value); + break; + case "ISACTIVE.value": + workflow.setProcessInstanceActive(processInstanceId, value == "true"); + break; + } +}); \ No newline at end of file diff --git a/entity/WorkflowTask_entity/WorkflowTask_entity.aod b/entity/WorkflowTask_entity/WorkflowTask_entity.aod index b065b5f71b..d0ef3808fa 100644 --- a/entity/WorkflowTask_entity/WorkflowTask_entity.aod +++ b/entity/WorkflowTask_entity/WorkflowTask_entity.aod @@ -6,6 +6,7 @@ <grantCreate v="false" /> <grantUpdateProcess>%aditoprj%/entity/WorkflowTask_entity/grantUpdateProcess.js</grantUpdateProcess> <grantDelete v="false" /> + <imageProcess>%aditoprj%/entity/WorkflowTask_entity/imageProcess.js</imageProcess> <titlePlural>Tasks</titlePlural> <recordContainer>jdito</recordContainer> <entityFields> @@ -39,6 +40,8 @@ </entityField> <entityField> <name>PROCESSINSTANCE_ID</name> + <linkedContext>WorkflowInstance</linkedContext> + <displayValueProcess>%aditoprj%/entity/WorkflowTask_entity/entityfields/processinstance_id/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>CREATE_TIME</name> @@ -69,9 +72,28 @@ </entityField> <entityProvider> <name>InstanceTasks</name> + <dependencies> + <entityDependency> + <name>5913327f-1bb4-48b8-846e-639274290cee</name> + <entityName>WorkflowInstance_entity</entityName> + <fieldName>Tasks</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> + <children> + <entityParameter> + <name>OnlyFinishedTasks_param</name> + <expose v="false" /> + </entityParameter> + <entityParameter> + <name>IncludeServiceTasks_param</name> + <expose v="false" /> + </entityParameter> + </children> </entityProvider> <entityParameter> <name>WorkflowInstanceId_param</name> + <expose v="true" /> </entityParameter> <entityField> <name>DESCRIPTION</name> @@ -86,6 +108,7 @@ <entityField> <name>ASSIGNEE</name> <title>Responsible</title> + <consumer>Employees</consumer> </entityField> <entityField> <name>DUEDATE</name> @@ -133,6 +156,45 @@ <name>PRIORITY</name> <title>Priority</title> </entityField> + <entityField> + <name>ICON</name> + <colorProcess>%aditoprj%/entity/WorkflowTask_entity/entityfields/icon/colorProcess.js</colorProcess> + <contentType>IMAGE</contentType> + </entityField> + <entityConsumer> + <name>Employees</name> + <dependency> + <name>dependency</name> + <entityName>Employee_entity</entityName> + <fieldName>EmployeesByUserId</fieldName> + </dependency> + </entityConsumer> + <entityParameter> + <name>OnlyFinishedTasks_param</name> + <expose v="true" /> + </entityParameter> + <entityProvider> + <name>FinishedInstanceTasks</name> + <dependencies> + <entityDependency> + <name>d5d39281-0183-42fa-960a-01347cddc85a</name> + <entityName>WorkflowInstance_entity</entityName> + <fieldName>FinishedTasks</fieldName> + <isConsumer v="false" /> + </entityDependency> + </dependencies> + <children> + <entityParameter> + <name>OnlyFinishedTasks_param</name> + <valueProcess>%aditoprj%/entity/WorkflowTask_entity/entityfields/finishedinstancetasks/children/onlyfinishedtasks_param/valueProcess.js</valueProcess> + <expose v="false" /> + </entityParameter> + </children> + </entityProvider> + <entityParameter> + <name>IncludeServiceTasks_param</name> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <jDitoRecordContainer> @@ -205,6 +267,9 @@ <jDitoRecordFieldMapping> <name>PRIORITY.value</name> </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>ICON.value</name> + </jDitoRecordFieldMapping> </recordFieldMappings> </jDitoRecordContainer> </recordContainers> diff --git a/entity/WorkflowTask_entity/entityfields/claimtask/stateProcess.js b/entity/WorkflowTask_entity/entityfields/claimtask/stateProcess.js index 594cc7db76..04ba44f544 100644 --- a/entity/WorkflowTask_entity/entityfields/claimtask/stateProcess.js +++ b/entity/WorkflowTask_entity/entityfields/claimtask/stateProcess.js @@ -3,7 +3,7 @@ import("Employee_lib"); import("system.vars"); import("system.result"); -result.string(vars.get("$field.ASSIGNEE") == EmployeeUtils.getCurrentUserId() +result.string(vars.get("$field.ASSIGNEE") || vars.get("$field.ISACTIVE") != "true" ? neon.COMPONENTSTATE_DISABLED : neon.COMPONENTSTATE_EDITABLE ); \ No newline at end of file diff --git a/entity/WorkflowTask_entity/entityfields/completetask/onActionProcess.js b/entity/WorkflowTask_entity/entityfields/completetask/onActionProcess.js index d91dfb391e..96372c6aa0 100644 --- a/entity/WorkflowTask_entity/entityfields/completetask/onActionProcess.js +++ b/entity/WorkflowTask_entity/entityfields/completetask/onActionProcess.js @@ -8,10 +8,9 @@ var params = { "TaskTitle_param" : vars.get("$field.NAME") }; if (formDefinition) - neon.openContext("WorkflowTask", null, uids, neon.OPERATINGSTATE_EDIT, params); + neon.openContext("WorkflowTask", "WorkflowTaskForm_view", uids, neon.OPERATINGSTATE_EDIT, params); else { workflow.completeTask(vars.get("$field.UID"), {}); - //if you try to open the task now, it will display "Task done" - neon.openContext("WorkflowTask", "WorkflowTaskPreview_view", uids, neon.OPERATINGSTATE_VIEW, params); + neon.refreshAll(); } \ No newline at end of file diff --git a/entity/WorkflowTask_entity/entityfields/completetask/stateProcess.js b/entity/WorkflowTask_entity/entityfields/completetask/stateProcess.js index 16def1966d..09d872a1af 100644 --- a/entity/WorkflowTask_entity/entityfields/completetask/stateProcess.js +++ b/entity/WorkflowTask_entity/entityfields/completetask/stateProcess.js @@ -2,4 +2,10 @@ import("system.neon"); import("system.vars"); import("system.result"); -result.string(vars.get("$field.PROCESSINSTANCE_ID") ? neon.COMPONENTSTATE_EDITABLE : neon.COMPONENTSTATE_INVISIBLE); \ No newline at end of file +var state = neon.COMPONENTSTATE_EDITABLE; +if (vars.get("$field.ISACTIVE") != "true") + state = neon.COMPONENTSTATE_DISABLED; +else if (!vars.get("$field.PROCESSINSTANCE_ID")) + state = neon.COMPONENTSTATE_INVISIBLE; + +result.string(state); \ No newline at end of file diff --git a/entity/WorkflowTask_entity/entityfields/finishedinstancetasks/children/onlyfinishedtasks_param/valueProcess.js b/entity/WorkflowTask_entity/entityfields/finishedinstancetasks/children/onlyfinishedtasks_param/valueProcess.js new file mode 100644 index 0000000000..40effa0178 --- /dev/null +++ b/entity/WorkflowTask_entity/entityfields/finishedinstancetasks/children/onlyfinishedtasks_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string(true); \ No newline at end of file diff --git a/entity/WorkflowTask_entity/entityfields/icon/colorProcess.js b/entity/WorkflowTask_entity/entityfields/icon/colorProcess.js new file mode 100644 index 0000000000..1d7d551d30 --- /dev/null +++ b/entity/WorkflowTask_entity/entityfields/icon/colorProcess.js @@ -0,0 +1,6 @@ +import("system.neon"); +import("system.vars"); +import("system.result"); + +if (vars.get("$field.ISACTIVE") != "true") + result.string(neon.READONLY_COLOR); \ No newline at end of file diff --git a/entity/WorkflowTask_entity/entityfields/processinstance_id/displayValueProcess.js b/entity/WorkflowTask_entity/entityfields/processinstance_id/displayValueProcess.js new file mode 100644 index 0000000000..af629bbe62 --- /dev/null +++ b/entity/WorkflowTask_entity/entityfields/processinstance_id/displayValueProcess.js @@ -0,0 +1,7 @@ +import("Context_lib"); +import("system.result"); +import("system.neon"); +import("system.vars"); + +if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET) + result.string(ContextUtils.loadContentTitle("WorkflowInstance_entity", vars.get("$field.PROCESSINSTANCE_ID"))); diff --git a/entity/WorkflowTask_entity/grantUpdateProcess.js b/entity/WorkflowTask_entity/grantUpdateProcess.js index 086d907893..ea6f76e26e 100644 --- a/entity/WorkflowTask_entity/grantUpdateProcess.js +++ b/entity/WorkflowTask_entity/grantUpdateProcess.js @@ -1,4 +1,4 @@ import("system.result"); import("system.vars"); -result.string(vars.get("$field.FORMDEFINITION") != ""); \ No newline at end of file +result.string(vars.get("$field.ISACTIVE") == "true"); \ No newline at end of file diff --git a/entity/WorkflowTask_entity/imageProcess.js b/entity/WorkflowTask_entity/imageProcess.js new file mode 100644 index 0000000000..f86b12ac2a --- /dev/null +++ b/entity/WorkflowTask_entity/imageProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.ICON")); \ No newline at end of file diff --git a/entity/WorkflowTask_entity/recordcontainers/jdito/contentProcess.js b/entity/WorkflowTask_entity/recordcontainers/jdito/contentProcess.js index a39ff9cc43..44b94eb5a2 100644 --- a/entity/WorkflowTask_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/WorkflowTask_entity/recordcontainers/jdito/contentProcess.js @@ -18,32 +18,54 @@ result.object((function () return []; var isOnlyForCurrentUser = vars.exists("$param.OnlyForCurrentUser_param") && vars.get("$param.OnlyForCurrentUser_param") == "true"; + var processInstanceId = vars.exists("$param.WorkflowInstanceId_param") && vars.get("$param.WorkflowInstanceId_param"); + var onlyFinished = vars.exists("$param.OnlyFinishedTasks_param") && vars.get("$param.OnlyFinishedTasks_param") == "true"; + var includeServiceTasks = vars.exists("$param.IncludeServiceTasks_param") && vars.get("$param.IncludeServiceTasks_param") == "true"; - var loadConfig = workflow.createConfigForLoadingTasks(); - var tasks; - - if (vars.get("$local.idvalues") && vars.get("$local.idvalues")[0]) + var loadConfig = onlyFinished + ? workflow.createConfigForLoadingHistoricTasks().finished(true) + : workflow.createConfigForLoadingTasks(); + + var taskIds = vars.get("$local.idvalues"); + + if (taskIds) { - var taskId = vars.get("$local.idvalues")[0]; - loadConfig = workflow.createConfigForLoadingTask() - .taskId(taskId); - - //TODO: there shouldn't be an error - try { - tasks = [JSON.parse(workflow.getTask(loadConfig))]; - } - catch (err) - { - //This can happen if the task is done, then it can't be loaded. If that's the case, return a dummy row - var taskTitle = vars.exists("$param.TaskTitle_param") && vars.get("$param.TaskTitle_param") || ""; - return [[taskId, translate.text("Task done"), taskTitle, "", vars.get("$sys.date"), "", "", "", "", "", "", "", "", "", "", "", "", "", ""]]; - } + loadConfig.taskIds(taskIds); } - else + else { // if (isOnlyForCurrentUser) // loadConfig.candidateIdentifier(EmployeeUtils.getCurrentUserId()); - tasks = JSON.parse(workflow.getTasks(loadConfig)); + if (processInstanceId) + loadConfig.processInstanceId(processInstanceId); + } + + var tasks = JSON.parse(onlyFinished + ? workflow.getHistoricTasks(loadConfig) + : workflow.getTasks(loadConfig)); + + //it is possible that a task is requested that was just finished -> if a task with given id could not be found, try to load it from historic tasks + if (tasks.length === 0 && taskIds && taskIds.length > 0 && !onlyFinished) + { + onlyFinished = true; + loadConfig = workflow.createConfigForLoadingHistoricTasks().taskIds(taskIds); + tasks = JSON.parse(workflow.getHistoricTasks(loadConfig)); + } + + if (includeServiceTasks && onlyFinished && processInstanceId) + { + JSON.parse(workflow.getFinishedActivities(processInstanceId)).forEach(function (activity) + { + if (activity.activityType == "serviceTask" && activity.activityName) + tasks.push({ + id : activity.id, + name : activity.activityName, + createTime : activity.startTime, + processDefinitionId : activity.processDefinitionId, + processInstanceId : activity.processInstanceId, + icon : "VAADIN:AUTOMATION" + }); + }); } var assigneeCache = { @@ -59,7 +81,14 @@ result.object((function () tasks = tasks.map(function (task) { - var variables = JSON.parse(workflow.getTaskVariables(task.id)); + var variables = JSON.parse(workflow.getTaskVariables(task.id)) || {}; + var icon = "NEON:STATUS_NOT_ASSIGNED"; + if (task.icon) + icon = task.icon; + else if (onlyFinished) + icon = "NEON:STATUS_DONE"; + else if (task.assignee) + icon = "NEON:STATUS_ASSIGNED"; return [ task.id, @@ -69,7 +98,7 @@ result.object((function () Date.parse(task.createTime).toString(), workflow.getFormProperties(task.id), "", - variables.USER_ID, + variables.USER_ID || "", task.description || "", task.category || "", task.assignee || "", @@ -78,15 +107,18 @@ result.object((function () task.owner || "", variables.targetContext || "", variables.targetId || "", - task.claimTime, - task.active, - task.priority + task.claimTime || "", + task.active || "false", + task.priority || "", + icon ]; }); tasks = JditoFilterUtils.filterRecords(["UID", "NAME", "PROCESSDEFINITION_ID", "PROCESSINSTANCE_ID", "CREATE_TIME", "FORMDEFINITION", "USER", "DESCRIPTION", "CATEGORY", "ASSIGNEE", "", "DUEDATE", "OWNER"], tasks, vars.get("$local.filter").filter); - + + //order by creation date + tasks.sort(function (a, b) {return b[4] - a[4];}); return tasks; })()); \ No newline at end of file diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index 84872d990b..a46bccfc52 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -6086,6 +6086,15 @@ <entry> <key>${ORDER_CANCELLED}</key> </entry> + <entry> + <key>Claim task</key> + </entry> + <entry> + <key>${WORKFLOW_SUSPEND}</key> + </entry> + <entry> + <key>Resume</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> <sqlModels> diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index d42a18b9fd..71dd431448 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -74,6 +74,10 @@ <key>Claim task</key> <value>Aufgabe annehmen</value> </entry> + <entry> + <key>Finished tasks</key> + <value>Abgeschlossene Aufgaben</value> + </entry> <entry> <key>Data imported.</key> <value>Daten wurden importiert.</value> @@ -145,6 +149,10 @@ <key>Education, Teaching and Reasearch</key> <value>Bildung, Lehre und Forschung</value> </entry> + <entry> + <key>${WORKFLOW_SUSPEND}</key> + <value>Anhalten</value> + </entry> <entry> <key>Start workflow</key> <value>Vorgang starten</value> @@ -693,6 +701,10 @@ <key>The person is already associated with another employee!</key> <value>Die Person ist bereits mit einem anderen Mitarbeiter verknüpft!</value> </entry> + <entry> + <key>Resume</key> + <value>Fortsetzen</value> + </entry> <entry> <key>Transmission</key> <value>Übermittlung</value> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index 4ad0897409..f18070fcf2 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -6143,6 +6143,16 @@ <entry> <key>${CANCELLED}</key> </entry> + <entry> + <key>Claim task</key> + </entry> + <entry> + <key>${WORKFLOW_SUSPEND}</key> + <value>Suspend</value> + </entry> + <entry> + <key>Resume</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/neonContext/WorkflowTask/WorkflowTask.aod b/neonContext/WorkflowTask/WorkflowTask.aod index 393e8d9457..43d132be62 100644 --- a/neonContext/WorkflowTask/WorkflowTask.aod +++ b/neonContext/WorkflowTask/WorkflowTask.aod @@ -3,7 +3,6 @@ <name>WorkflowTask</name> <majorModelMode>DISTRIBUTED</majorModelMode> <filterView>WorkflowTaskFilter_view</filterView> - <editView>WorkflowTaskForm_view</editView> <previewView>WorkflowTaskPreview_view</previewView> <entity>WorkflowTask_entity</entity> <references> @@ -23,5 +22,13 @@ <name>c10f6321-3d85-4c95-b9ec-0f6d5b91fb95</name> <view>WorkflowTaskOwn_view</view> </neonViewReference> + <neonViewReference> + <name>bf1d15ff-a0dc-401f-874a-342e8195eb29</name> + <view>WorkflowTaskList_view</view> + </neonViewReference> + <neonViewReference> + <name>a86af6be-5e80-4e4c-8717-76976ff192b9</name> + <view>WorkflowTaskFinishedList_view</view> + </neonViewReference> </references> </neonContext> diff --git a/neonView/WorkflowInstanceEdit_view/WorkflowInstanceEdit_view.aod b/neonView/WorkflowInstanceEdit_view/WorkflowInstanceEdit_view.aod index 9cde51ce7c..316636b189 100644 --- a/neonView/WorkflowInstanceEdit_view/WorkflowInstanceEdit_view.aod +++ b/neonView/WorkflowInstanceEdit_view/WorkflowInstanceEdit_view.aod @@ -18,6 +18,10 @@ <name>1a8b8257-0502-4ac4-8cc9-7fb7734570b4</name> <entityField>KEY</entityField> </entityFieldLink> + <entityFieldLink> + <name>dc692ed7-3c26-42ab-b251-ce1f1e438e6b</name> + <entityField>NAME</entityField> + </entityFieldLink> </fields> </genericViewTemplate> </children> diff --git a/neonView/WorkflowInstanceFilter_view/WorkflowInstanceFilter_view.aod b/neonView/WorkflowInstanceFilter_view/WorkflowInstanceFilter_view.aod index 0b6285e26f..f8ce8e1dd5 100644 --- a/neonView/WorkflowInstanceFilter_view/WorkflowInstanceFilter_view.aod +++ b/neonView/WorkflowInstanceFilter_view/WorkflowInstanceFilter_view.aod @@ -13,12 +13,12 @@ <name>Table</name> <entityField>#ENTITY</entityField> <linkedColumns> - <element>PROCESSDEFINITION_ID</element> + <element>NAME</element> </linkedColumns> <columns> <neonTableColumn> <name>c5d2c47a-5b20-49c9-b49c-5aee951ce2db</name> - <entityField>PROCESSDEFINITION_ID</entityField> + <entityField>NAME</entityField> </neonTableColumn> <neonTableColumn> <name>d8f5093e-d547-4276-ae46-536182bffbc0</name> diff --git a/neonView/WorkflowInstancePreview_view/WorkflowInstancePreview_view.aod b/neonView/WorkflowInstancePreview_view/WorkflowInstancePreview_view.aod index e4b9bacc9a..868ba90fa2 100644 --- a/neonView/WorkflowInstancePreview_view/WorkflowInstancePreview_view.aod +++ b/neonView/WorkflowInstancePreview_view/WorkflowInstancePreview_view.aod @@ -11,8 +11,8 @@ <children> <cardViewTemplate> <name>Card</name> - <titleField>PROCESSDEFINITION_ID</titleField> - <subtitleField>KEY</subtitleField> + <titleField>NAME</titleField> + <subtitleField>PROCESSDEFINITION_ID</subtitleField> <entityField>#ENTITY</entityField> </cardViewTemplate> <genericViewTemplate> @@ -39,5 +39,15 @@ </entityFieldLink> </fields> </genericViewTemplate> + <neonViewReference> + <name>def92a6c-f556-4e4f-917b-82c3940afcc4</name> + <entityField>Tasks</entityField> + <view>WorkflowTaskList_view</view> + </neonViewReference> + <neonViewReference> + <name>908012ad-82d7-45c0-9a4b-ba6e00cc1e8c</name> + <entityField>FinishedTasks</entityField> + <view>WorkflowTaskFinishedList_view</view> + </neonViewReference> </children> </neonView> diff --git a/neonView/WorkflowTaskFilter_view/WorkflowTaskFilter_view.aod b/neonView/WorkflowTaskFilter_view/WorkflowTaskFilter_view.aod index d88575a489..713eaa5b44 100644 --- a/neonView/WorkflowTaskFilter_view/WorkflowTaskFilter_view.aod +++ b/neonView/WorkflowTaskFilter_view/WorkflowTaskFilter_view.aod @@ -11,11 +11,16 @@ <children> <tableViewTemplate> <name>Table</name> + <iconField>#IMAGE</iconField> <entityField>#ENTITY</entityField> <linkedColumns> <element>NAME</element> </linkedColumns> <columns> + <neonTableColumn> + <name>54e2e8a6-98e5-4ab7-ac04-c29b10d3d662</name> + <entityField>ICON</entityField> + </neonTableColumn> <neonTableColumn> <name>e6c73b5b-1ae0-4337-9c83-39f9fc0b1469</name> <entityField>NAME</entityField> diff --git a/neonView/WorkflowTaskFinishedList_view/WorkflowTaskFinishedList_view.aod b/neonView/WorkflowTaskFinishedList_view/WorkflowTaskFinishedList_view.aod new file mode 100644 index 0000000000..e6459eea52 --- /dev/null +++ b/neonView/WorkflowTaskFinishedList_view/WorkflowTaskFinishedList_view.aod @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.4" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.4"> + <name>WorkflowTaskFinishedList_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <drawerLayout> + <name>layout</name> + <layoutCaption>Finished tasks</layoutCaption> + </drawerLayout> + </layout> + <children> + <actionListViewTemplate> + <name>ActionList</name> + <titleField>NAME</titleField> + <descriptionField>DESCRIPTION</descriptionField> + <iconField>ICON</iconField> + <entityField>#ENTITY</entityField> + </actionListViewTemplate> + </children> +</neonView> diff --git a/neonView/WorkflowTaskForm_view/WorkflowTaskForm_view.aod b/neonView/WorkflowTaskForm_view/WorkflowTaskForm_view.aod index f3da1166d8..f2c71adb10 100644 --- a/neonView/WorkflowTaskForm_view/WorkflowTaskForm_view.aod +++ b/neonView/WorkflowTaskForm_view/WorkflowTaskForm_view.aod @@ -13,6 +13,7 @@ <name>DynamicForm</name> <formDefinition>FORMDEFINITION</formDefinition> <formResult>FORMRESULT</formResult> + <editMode v="true" /> <entityField>#ENTITY</entityField> </dynamicFormViewTemplate> </children> diff --git a/neonView/WorkflowTaskList_view/WorkflowTaskList_view.aod b/neonView/WorkflowTaskList_view/WorkflowTaskList_view.aod new file mode 100644 index 0000000000..0b947c2441 --- /dev/null +++ b/neonView/WorkflowTaskList_view/WorkflowTaskList_view.aod @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.4" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.4"> + <name>WorkflowTaskList_view</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <layout> + <drawerLayout> + <name>layout</name> + <layoutCaption>Tasks</layoutCaption> + </drawerLayout> + </layout> + <children> + <actionListViewTemplate> + <name>ActionList</name> + <titleField>NAME</titleField> + <descriptionField>DESCRIPTION</descriptionField> + <iconField>ICON</iconField> + <entityField>#ENTITY</entityField> + </actionListViewTemplate> + </children> +</neonView> diff --git a/neonView/WorkflowTaskOwn_view/WorkflowTaskOwn_view.aod b/neonView/WorkflowTaskOwn_view/WorkflowTaskOwn_view.aod index e61fa34cdf..81f088cc89 100644 --- a/neonView/WorkflowTaskOwn_view/WorkflowTaskOwn_view.aod +++ b/neonView/WorkflowTaskOwn_view/WorkflowTaskOwn_view.aod @@ -32,11 +32,16 @@ <children> <tableViewTemplate> <name>Table</name> + <iconField>#IMAGE</iconField> <entityField>#ENTITY</entityField> <linkedColumns> <element>NAME</element> </linkedColumns> <columns> + <neonTableColumn> + <name>6d59e221-bdca-49e9-9909-ed7a777e9116</name> + <entityField>ICON</entityField> + </neonTableColumn> <neonTableColumn> <name>2debfca6-7aaf-48b6-8b8f-2310c0513229</name> <entityField>CREATE_TIME</entityField> diff --git a/neonView/WorkflowTaskPreview_view/WorkflowTaskPreview_view.aod b/neonView/WorkflowTaskPreview_view/WorkflowTaskPreview_view.aod index 661e81ca14..c1b72bdced 100644 --- a/neonView/WorkflowTaskPreview_view/WorkflowTaskPreview_view.aod +++ b/neonView/WorkflowTaskPreview_view/WorkflowTaskPreview_view.aod @@ -12,8 +12,9 @@ <children> <cardViewTemplate> <name>Card</name> + <iconField>ICON</iconField> <titleField>NAME</titleField> - <subtitleField>PROCESSDEFINITION_ID</subtitleField> + <subtitleField>PROCESSINSTANCE_ID</subtitleField> <favoriteAction1>completeTask</favoriteAction1> <entityField>#ENTITY</entityField> </cardViewTemplate> -- GitLab