diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod index 7c9a1eec7867220d47a233759f594375e4e64956..bf3a396fb3289d386327a92f72f3fb29eca482ee 100644 --- a/entity/Organisation_entity/Organisation_entity.aod +++ b/entity/Organisation_entity/Organisation_entity.aod @@ -8,6 +8,7 @@ <grantDeleteProcess>%aditoprj%/entity/Organisation_entity/grantDeleteProcess.js</grantDeleteProcess> <contentTitleProcess>%aditoprj%/entity/Organisation_entity/contentTitleProcess.js</contentTitleProcess> <afterUiInit>%aditoprj%/entity/Organisation_entity/afterUiInit.js</afterUiInit> + <afterOperatingState>%aditoprj%/entity/Organisation_entity/afterOperatingState.js</afterOperatingState> <iconId>VAADIN:BUILDING</iconId> <imageProcess>%aditoprj%/entity/Organisation_entity/imageProcess.js</imageProcess> <titlePlural>Companies</titlePlural> @@ -1042,6 +1043,7 @@ <fromClauseProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess> <conditionProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/Organisation_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> + <onDBInsert>%aditoprj%/entity/Organisation_entity/recordcontainers/db/onDBInsert.js</onDBInsert> <onDBUpdate>%aditoprj%/entity/Organisation_entity/recordcontainers/db/onDBUpdate.js</onDBUpdate> <onDBDelete>%aditoprj%/entity/Organisation_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> diff --git a/entity/Organisation_entity/afterOperatingState.js b/entity/Organisation_entity/afterOperatingState.js new file mode 100644 index 0000000000000000000000000000000000000000..95c27335097d5a484f25b37e679dbc332eb8302a --- /dev/null +++ b/entity/Organisation_entity/afterOperatingState.js @@ -0,0 +1,8 @@ +import("system.vars"); +import("Workflow_lib"); + +if (vars.exists("$context.workflowQueue") && vars.get("$context.workflowQueue")) +{ + WorkflowStarter.inserted(vars.get("$context.workflowQueue")); + vars.set("$context.workflowQueue", null); +} \ No newline at end of file diff --git a/entity/Organisation_entity/recordcontainers/db/onDBDelete.js b/entity/Organisation_entity/recordcontainers/db/onDBDelete.js index 8bc517ecf8302dd65a3577278f6639653a1f6985..a964f1770ac6b37ae9ddc69d963436b9bb9661d9 100644 --- a/entity/Organisation_entity/recordcontainers/db/onDBDelete.js +++ b/entity/Organisation_entity/recordcontainers/db/onDBDelete.js @@ -1,5 +1,8 @@ +import("Workflow_lib"); import("system.vars"); import("DuplicateScanner_lib"); let contactId = vars.get("$field.CONTACTID"); -DuplicateScannerUtils.DeleteCachedDuplicate(contactId); \ No newline at end of file +DuplicateScannerUtils.DeleteCachedDuplicate(contactId); + +WorkflowStarter.deleted(); \ No newline at end of file diff --git a/entity/Organisation_entity/recordcontainers/db/onDBInsert.js b/entity/Organisation_entity/recordcontainers/db/onDBInsert.js new file mode 100644 index 0000000000000000000000000000000000000000..658ba4e14cb08f09df3fd7347906ed6b6db7324d --- /dev/null +++ b/entity/Organisation_entity/recordcontainers/db/onDBInsert.js @@ -0,0 +1,4 @@ +import("system.vars"); + +//start the execution in afterOperatingState, because here the dataset is not yet inserted +vars.set("$context.workflowQueue", {}); \ No newline at end of file diff --git a/entity/Organisation_entity/recordcontainers/db/onDBUpdate.js b/entity/Organisation_entity/recordcontainers/db/onDBUpdate.js index e1c84abb098210321a7846ded93657c06adf7f89..5738b35a68a596799ae8c74974107c811a9e6aea 100644 --- a/entity/Organisation_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Organisation_entity/recordcontainers/db/onDBUpdate.js @@ -2,6 +2,7 @@ import("system.vars"); import("Organisation_lib"); import("Communication_lib"); import("Entity_lib"); +import("Workflow_lib"); // TODO: this is a workaround for missing possibility to react on changes of fields not connected to record Contqainer #1030023 var rowdata = vars.get("$local.rowdata"); @@ -13,3 +14,5 @@ FieldChanges.assimilateChangeAndDispose("$field.STANDARD_EMAIL_COMMUNICATION", f FieldChanges.assimilateChangeAndDispose("$field.STANDARD_PHONE_COMMUNICATION", function(state, value){ CommUtil.setStandardPhone(uid, value); }); + +WorkflowStarter.updated(); \ No newline at end of file diff --git a/entity/Person_entity/Person_entity.aod b/entity/Person_entity/Person_entity.aod index ae5734c3d3914aa74241f40b6bc4d36ddcd00cad..94789712803ab85aeb44695f0ba7f5118dfe66d6 100644 --- a/entity/Person_entity/Person_entity.aod +++ b/entity/Person_entity/Person_entity.aod @@ -12,6 +12,7 @@ <contentTitleProcess>%aditoprj%/entity/Person_entity/contentTitleProcess.js</contentTitleProcess> <afterUiInit>%aditoprj%/entity/Person_entity/afterUiInit.js</afterUiInit> <onValidation>%aditoprj%/entity/Person_entity/onValidation.js</onValidation> + <afterOperatingState>%aditoprj%/entity/Person_entity/afterOperatingState.js</afterOperatingState> <iconId>VAADIN:USERS</iconId> <imageProcess>%aditoprj%/entity/Person_entity/imageProcess.js</imageProcess> <usePermissions v="false" /> diff --git a/entity/Person_entity/afterOperatingState.js b/entity/Person_entity/afterOperatingState.js new file mode 100644 index 0000000000000000000000000000000000000000..95c27335097d5a484f25b37e679dbc332eb8302a --- /dev/null +++ b/entity/Person_entity/afterOperatingState.js @@ -0,0 +1,8 @@ +import("system.vars"); +import("Workflow_lib"); + +if (vars.exists("$context.workflowQueue") && vars.get("$context.workflowQueue")) +{ + WorkflowStarter.inserted(vars.get("$context.workflowQueue")); + vars.set("$context.workflowQueue", null); +} \ No newline at end of file diff --git a/entity/Person_entity/recordcontainers/db/onDBDelete.js b/entity/Person_entity/recordcontainers/db/onDBDelete.js index 8bc517ecf8302dd65a3577278f6639653a1f6985..a964f1770ac6b37ae9ddc69d963436b9bb9661d9 100644 --- a/entity/Person_entity/recordcontainers/db/onDBDelete.js +++ b/entity/Person_entity/recordcontainers/db/onDBDelete.js @@ -1,5 +1,8 @@ +import("Workflow_lib"); import("system.vars"); import("DuplicateScanner_lib"); let contactId = vars.get("$field.CONTACTID"); -DuplicateScannerUtils.DeleteCachedDuplicate(contactId); \ No newline at end of file +DuplicateScannerUtils.DeleteCachedDuplicate(contactId); + +WorkflowStarter.deleted(); \ No newline at end of file diff --git a/entity/Person_entity/recordcontainers/db/onDBInsert.js b/entity/Person_entity/recordcontainers/db/onDBInsert.js index 0cb5e08e17f469125f45e7dbeb7429c6b5a9102c..39b660ad34493019ba48bf77c9f5d688b0f72820 100644 --- a/entity/Person_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Person_entity/recordcontainers/db/onDBInsert.js @@ -8,6 +8,9 @@ import("system.vars"); let contactId = vars.get("$local.uid"); DataPrivacyUtils.notifyNeedDataPrivacyUpdate(contactId); +//start the execution in afterOperatingState, because here the dataset is not yet inserted +vars.set("$context.workflowQueue", {}); + //let valuesToCheck = {}; // //var entityModel = project.getEntityStructure(targetEntity); diff --git a/entity/Person_entity/recordcontainers/db/onDBUpdate.js b/entity/Person_entity/recordcontainers/db/onDBUpdate.js index 3d9565faae7561f0b4adc79797c0a0f030829d16..0e8c2769a286c142ab77ddf31f284d62c33347e0 100644 --- a/entity/Person_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Person_entity/recordcontainers/db/onDBUpdate.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("DataPrivacy_lib"); import("system.tools"); import("system.vars"); @@ -40,4 +41,6 @@ vars.get("$local.changed").forEach(function(fieldName) } }) -DataPrivacyUtils.notifyNeedDataPrivacyUpdate(uid); \ No newline at end of file +DataPrivacyUtils.notifyNeedDataPrivacyUpdate(uid); + +WorkflowStarter.updated(); \ No newline at end of file diff --git a/entity/Salesproject_entity/afterOperatingState.js b/entity/Salesproject_entity/afterOperatingState.js index e93da299eeb50537fa1fa0d5c1ad736528772b82..30dc6947ef78065a5d4341a489a633733684d27a 100644 --- a/entity/Salesproject_entity/afterOperatingState.js +++ b/entity/Salesproject_entity/afterOperatingState.js @@ -1,8 +1,14 @@ import("system.vars"); -import("system.neon"); +import("Workflow_lib"); + +if (vars.exists("$context.workflowQueue") && vars.get("$context.workflowQueue")) +{ + WorkflowStarter.inserted(vars.get("$context.workflowQueue")); + vars.set("$context.workflowQueue", null); +} //TODO: error on save, why should be a refresh necessary //if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_VIEW) //{ // neon.refresh(); -//} \ No newline at end of file +//} diff --git a/entity/Salesproject_entity/recordcontainers/db/onDBDelete.js b/entity/Salesproject_entity/recordcontainers/db/onDBDelete.js index 081b794d83a6d1cebc4f0e4b52abd1d58ff4ae28..050a3e6b0da0d33875135bd9c1c8f5cb40503737 100644 --- a/entity/Salesproject_entity/recordcontainers/db/onDBDelete.js +++ b/entity/Salesproject_entity/recordcontainers/db/onDBDelete.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("Context_lib"); import("system.db"); import("system.vars"); @@ -39,4 +40,6 @@ if (currentId) db.deletes(toDelete); // TODO: auch Dokumente, Aktivitäten, Aufgaben, Zeiterfassungen löschen? -} \ No newline at end of file +} + +WorkflowStarter.deleted(); \ No newline at end of file diff --git a/entity/Salesproject_entity/recordcontainers/db/onDBInsert.js b/entity/Salesproject_entity/recordcontainers/db/onDBInsert.js index 3e831c35c92307b1716fc726e9c7f03a9c708671..f083e30bb67678b79e0da92563162376437beeb6 100644 --- a/entity/Salesproject_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Salesproject_entity/recordcontainers/db/onDBInsert.js @@ -13,4 +13,7 @@ if (vars.get("$field.PROJECTTYPE")) { new AttributeRelationQuery(rowdata["SALESPROJECT.SALESPROJECTID"], $AttributeRegistry.salesprojectType(), ContextUtils.getCurrentContextId()) .insertAttribute(vars.get("$field.PROJECTTYPE"), true); -} \ No newline at end of file +} + +//start the execution in afterOperatingState, because here the dataset is not yet inserted +vars.set("$context.workflowQueue", {}); \ No newline at end of file diff --git a/entity/Salesproject_entity/recordcontainers/db/onDBUpdate.js b/entity/Salesproject_entity/recordcontainers/db/onDBUpdate.js index 4ebf9f01b90ebf9629c48f16f77d5b1232c8c097..ee7d781f7a1d3a0c00ff46c87ab76971369f92d6 100644 --- a/entity/Salesproject_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Salesproject_entity/recordcontainers/db/onDBUpdate.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("Context_lib"); import("system.neon"); import("system.translate"); @@ -99,6 +100,8 @@ vars.get("$local.changed").forEach(function(fieldName) { if (needToUpdateForecast) Salesproject.notifyToUpdateForecast(); +WorkflowStarter.updated(); + neon.refreshAll(); function _updateReasons()