From d846262dc7feb55b631ec3bb46e4475798c66bb9 Mon Sep 17 00:00:00 2001 From: "S.Listl" <S.Listl@SLISTL.aditosoftware.local> Date: Wed, 29 Apr 2020 14:39:43 +0200 Subject: [PATCH] More usages of workflow signals added --- .../2020.1.0/add_WorkflowSignal_variables.xml | 9 ++ .../Data_alias/basic/2020.1.0/changelog.xml | 1 + aliasDefinition/Data_alias/Data_alias.aod | 14 +++ entity/Activity_entity/Activity_entity.aod | 1 + .../recordcontainers/db/onDBDelete.js | 4 +- .../recordcontainers/db/onDBInsert.js | 5 +- .../recordcontainers/db/onDBUpdate.js | 3 + .../BulkMailRecipient_entity.aod | 3 + .../recordcontainers/db/onDBDelete.js | 3 + .../recordcontainers/db/onDBInsert.js | 3 + .../recordcontainers/db/onDBUpdate.js | 3 + .../recordcontainers/db/onDBDelete.js | 5 +- .../recordcontainers/db/onDBInsert.js | 5 +- .../recordcontainers/db/onDBUpdate.js | 5 +- .../CampaignStep_entity.aod | 3 + .../recordcontainers/db/onDBDelete.js | 3 + .../recordcontainers/db/onDBInsert.js | 3 + .../recordcontainers/db/onDBUpdate.js | 3 + entity/Campaign_entity/Campaign_entity.aod | 1 + .../recordcontainers/db/onDBDelete.js | 5 +- .../recordcontainers/db/onDBInsert.js | 5 +- .../recordcontainers/db/onDBUpdate.js | 3 + entity/Contract_entity/Contract_entity.aod | 2 + .../recordcontainers/db/onDBDelete.js | 5 +- .../recordcontainers/db/onDBInsert.js | 3 + .../recordcontainers/db/onDBUpdate.js | 3 + .../recordcontainers/db/onDBDelete.js | 5 +- .../recordcontainers/db/onDBInsert.js | 5 +- .../recordcontainers/db/onDBUpdate.js | 5 +- .../recordcontainers/jdito/onDelete.js | 3 + .../recordcontainers/jdito/onInsert.js | 5 +- .../recordcontainers/jdito/onUpdate.js | 5 +- .../LetterRecipient_entity.aod | 3 + .../recordcontainers/db/onDBDelete.js | 3 + .../recordcontainers/db/onDBInsert.js | 3 + .../recordcontainers/db/onDBUpdate.js | 3 + entity/Offer_entity/afterOperatingState.js | 3 +- .../recordcontainers/db/onDBInsert.js | 2 +- .../recordcontainers/db/onDBUpdate.js | 2 +- entity/Order_entity/Order_entity.aod | 1 + .../recordcontainers/db/onDBDelete.js | 5 +- .../recordcontainers/db/onDBInsert.js | 3 + .../recordcontainers/db/onDBUpdate.js | 3 + .../afterOperatingState.js | 3 +- .../recordcontainers/db/onDBDelete.js | 2 +- .../recordcontainers/db/onDBInsert.js | 2 +- .../recordcontainers/db/onDBUpdate.js | 2 +- entity/Person_entity/afterOperatingState.js | 3 +- .../recordcontainers/db/onDBDelete.js | 2 +- .../recordcontainers/db/onDBInsert.js | 2 +- .../recordcontainers/db/onDBUpdate.js | 2 +- entity/Product_entity/Product_entity.aod | 1 + .../recordcontainers/db/onDBDelete.js | 5 +- .../recordcontainers/db/onDBInsert.js | 3 + .../recordcontainers/db/onDBUpdate.js | 3 + .../recordcontainers/db/onDBDelete.js | 3 +- .../recordcontainers/db/onDBInsert.js | 4 +- .../recordcontainers/db/onDBUpdate.js | 1 + .../recordcontainers/db/onDBDelete.js | 5 +- .../recordcontainers/db/onDBInsert.js | 5 +- .../recordcontainers/db/onDBUpdate.js | 3 + .../SupportTicket_entity.aod | 1 + .../recordcontainers/db/onDBDelete.js | 5 +- .../recordcontainers/db/onDBInsert.js | 5 +- .../recordcontainers/db/onDBUpdate.js | 3 + entity/Task_entity/Task_entity.aod | 2 + .../recordcontainers/db/onDBDelete.js | 5 +- .../recordcontainers/db/onDBInsert.js | 3 + .../recordcontainers/db/onDBUpdate.js | 3 + .../recordcontainers/jdito/onInsert.js | 6 +- .../WorkflowSignal_entity.aod | 21 ++++ .../children/blacklist_param/valueProcess.js | 22 ++++ .../invertblacklist_param/valueProcess.js | 3 + .../entityfields/variables/dropDownProcess.js | 10 ++ .../entityfields/variables/valueProcess.js | 8 ++ .../recordcontainers/jdito/contentProcess.js | 4 +- .../WorkflowSignalEdit_view.aod | 4 + .../CreateNotification_workflowService.aod | 1 + .../process.js | 2 +- process/Workflow_lib/process.js | 103 ++++++------------ 80 files changed, 313 insertions(+), 111 deletions(-) create mode 100644 .liquibase/Data_alias/basic/2020.1.0/add_WorkflowSignal_variables.xml create mode 100644 entity/Activity_entity/recordcontainers/db/onDBUpdate.js create mode 100644 entity/BulkMailRecipient_entity/recordcontainers/db/onDBDelete.js create mode 100644 entity/BulkMailRecipient_entity/recordcontainers/db/onDBInsert.js create mode 100644 entity/BulkMailRecipient_entity/recordcontainers/db/onDBUpdate.js create mode 100644 entity/CampaignStep_entity/recordcontainers/db/onDBDelete.js create mode 100644 entity/CampaignStep_entity/recordcontainers/db/onDBInsert.js create mode 100644 entity/CampaignStep_entity/recordcontainers/db/onDBUpdate.js create mode 100644 entity/Campaign_entity/recordcontainers/db/onDBUpdate.js create mode 100644 entity/Contract_entity/recordcontainers/db/onDBInsert.js create mode 100644 entity/Contract_entity/recordcontainers/db/onDBUpdate.js create mode 100644 entity/LetterRecipient_entity/recordcontainers/db/onDBDelete.js create mode 100644 entity/LetterRecipient_entity/recordcontainers/db/onDBInsert.js create mode 100644 entity/LetterRecipient_entity/recordcontainers/db/onDBUpdate.js create mode 100644 entity/Order_entity/recordcontainers/db/onDBUpdate.js create mode 100644 entity/Product_entity/recordcontainers/db/onDBInsert.js create mode 100644 entity/SupportTicket_entity/recordcontainers/db/onDBUpdate.js create mode 100644 entity/Task_entity/recordcontainers/db/onDBInsert.js create mode 100644 entity/Task_entity/recordcontainers/db/onDBUpdate.js create mode 100644 entity/WorkflowSignal_entity/entityfields/contexts/children/blacklist_param/valueProcess.js create mode 100644 entity/WorkflowSignal_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js create mode 100644 entity/WorkflowSignal_entity/entityfields/variables/dropDownProcess.js create mode 100644 entity/WorkflowSignal_entity/entityfields/variables/valueProcess.js diff --git a/.liquibase/Data_alias/basic/2020.1.0/add_WorkflowSignal_variables.xml b/.liquibase/Data_alias/basic/2020.1.0/add_WorkflowSignal_variables.xml new file mode 100644 index 0000000000..a5b333877f --- /dev/null +++ b/.liquibase/Data_alias/basic/2020.1.0/add_WorkflowSignal_variables.xml @@ -0,0 +1,9 @@ +<?xml version="1.1" encoding="UTF-8" standalone="no"?> +<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd"> + <changeSet author="s.listl" id="75b28058-b945-4a42-9f5b-7374df1cacde"> + <addColumn tableName="WORKFLOWSIGNAL"> + <column name="VARIABLES" type="VARCHAR(512)"/> + </addColumn> + </changeSet> +</databaseChangeLog> diff --git a/.liquibase/Data_alias/basic/2020.1.0/changelog.xml b/.liquibase/Data_alias/basic/2020.1.0/changelog.xml index 814024a25b..67df9d757e 100644 --- a/.liquibase/Data_alias/basic/2020.1.0/changelog.xml +++ b/.liquibase/Data_alias/basic/2020.1.0/changelog.xml @@ -8,4 +8,5 @@ <include relativeToChangelogFile="true" file="changeType_SALESORDER_PAID_UNPAID.xml"/> <include relativeToChangelogFile="true" file="changeType_SALESORDER_PAID_UNPAID.xml"/> <include relativeToChangelogFile="true" file="delete_leadImportKeywords.xml"/> + <include relativeToChangelogFile="true" file="add_WorkflowSignal_variables.xml"/> </databaseChangeLog> diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index ebf1b8d19f..879c30612a 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -13947,6 +13947,20 @@ <title></title> <description></description> </entityFieldDb> + <entityFieldDb> + <name>VARIABLES</name> + <dbName></dbName> + <primaryKey v="false" /> + <columnType v="12" /> + <size v="512" /> + <scale v="0" /> + <notNull v="false" /> + <isUnique v="false" /> + <index v="false" /> + <documentation></documentation> + <title></title> + <description></description> + </entityFieldDb> </entityFields> </entityDb> <entityDb> diff --git a/entity/Activity_entity/Activity_entity.aod b/entity/Activity_entity/Activity_entity.aod index 687ca2399d..8258e93b05 100644 --- a/entity/Activity_entity/Activity_entity.aod +++ b/entity/Activity_entity/Activity_entity.aod @@ -604,6 +604,7 @@ <conditionProcess>%aditoprj%/entity/Activity_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/Activity_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> <onDBInsert>%aditoprj%/entity/Activity_entity/recordcontainers/db/onDBInsert.js</onDBInsert> + <onDBUpdate>%aditoprj%/entity/Activity_entity/recordcontainers/db/onDBUpdate.js</onDBUpdate> <onDBDelete>%aditoprj%/entity/Activity_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> diff --git a/entity/Activity_entity/recordcontainers/db/onDBDelete.js b/entity/Activity_entity/recordcontainers/db/onDBDelete.js index a50bce1e44..92347de26d 100644 --- a/entity/Activity_entity/recordcontainers/db/onDBDelete.js +++ b/entity/Activity_entity/recordcontainers/db/onDBDelete.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("Context_lib"); import("system.vars"); import("Sql_lib"); @@ -7,4 +8,5 @@ newWhere("ACTIVITYLINK.ACTIVITY_ID", "$field.ACTIVITYID").deleteData(); new AttributeRelationQuery(vars.get("$field.ACTIVITYID"), null, ContextUtils.getCurrentContextId()) .deleteAllAttributes(); - \ No newline at end of file + +WorkflowSignalSender.deleted(); \ No newline at end of file diff --git a/entity/Activity_entity/recordcontainers/db/onDBInsert.js b/entity/Activity_entity/recordcontainers/db/onDBInsert.js index e67f7ab087..54e631277f 100644 --- a/entity/Activity_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Activity_entity/recordcontainers/db/onDBInsert.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("Sql_lib"); import("KeywordRegistry_basic"); import("Document_lib"); @@ -41,4 +42,6 @@ if (vars.exists("$param.InsertLinks_param") && vars.get("$param.InsertLinks_para { ActivityUtils.insertLink(activityId, objectType, rowId); }); -} \ No newline at end of file +} + +WorkflowSignalSender.inserted(); \ No newline at end of file diff --git a/entity/Activity_entity/recordcontainers/db/onDBUpdate.js b/entity/Activity_entity/recordcontainers/db/onDBUpdate.js new file mode 100644 index 0000000000..2e53f3cad9 --- /dev/null +++ b/entity/Activity_entity/recordcontainers/db/onDBUpdate.js @@ -0,0 +1,3 @@ +import("Workflow_lib"); + +WorkflowSignalSender.updated(); \ No newline at end of file diff --git a/entity/BulkMailRecipient_entity/BulkMailRecipient_entity.aod b/entity/BulkMailRecipient_entity/BulkMailRecipient_entity.aod index 1634c492c0..e8de32709b 100644 --- a/entity/BulkMailRecipient_entity/BulkMailRecipient_entity.aod +++ b/entity/BulkMailRecipient_entity/BulkMailRecipient_entity.aod @@ -149,6 +149,9 @@ <fromClauseProcess>%aditoprj%/entity/BulkMailRecipient_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess> <conditionProcess>%aditoprj%/entity/BulkMailRecipient_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/BulkMailRecipient_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> + <onDBInsert>%aditoprj%/entity/BulkMailRecipient_entity/recordcontainers/db/onDBInsert.js</onDBInsert> + <onDBUpdate>%aditoprj%/entity/BulkMailRecipient_entity/recordcontainers/db/onDBUpdate.js</onDBUpdate> + <onDBDelete>%aditoprj%/entity/BulkMailRecipient_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> <name>b8fa2cab-18d8-4297-adc3-191d21f60c3a</name> diff --git a/entity/BulkMailRecipient_entity/recordcontainers/db/onDBDelete.js b/entity/BulkMailRecipient_entity/recordcontainers/db/onDBDelete.js new file mode 100644 index 0000000000..6ff91a5eb3 --- /dev/null +++ b/entity/BulkMailRecipient_entity/recordcontainers/db/onDBDelete.js @@ -0,0 +1,3 @@ +import("Workflow_lib"); + +WorkflowSignalSender.deleted(); \ No newline at end of file diff --git a/entity/BulkMailRecipient_entity/recordcontainers/db/onDBInsert.js b/entity/BulkMailRecipient_entity/recordcontainers/db/onDBInsert.js new file mode 100644 index 0000000000..54f0349c9f --- /dev/null +++ b/entity/BulkMailRecipient_entity/recordcontainers/db/onDBInsert.js @@ -0,0 +1,3 @@ +import("Workflow_lib"); + +WorkflowSignalSender.inserted(); \ No newline at end of file diff --git a/entity/BulkMailRecipient_entity/recordcontainers/db/onDBUpdate.js b/entity/BulkMailRecipient_entity/recordcontainers/db/onDBUpdate.js new file mode 100644 index 0000000000..2e53f3cad9 --- /dev/null +++ b/entity/BulkMailRecipient_entity/recordcontainers/db/onDBUpdate.js @@ -0,0 +1,3 @@ +import("Workflow_lib"); + +WorkflowSignalSender.updated(); \ No newline at end of file diff --git a/entity/BulkMail_entity/recordcontainers/db/onDBDelete.js b/entity/BulkMail_entity/recordcontainers/db/onDBDelete.js index 56bcea26cf..69fbfd853d 100644 --- a/entity/BulkMail_entity/recordcontainers/db/onDBDelete.js +++ b/entity/BulkMail_entity/recordcontainers/db/onDBDelete.js @@ -1,7 +1,10 @@ +import("Workflow_lib"); import("system.vars"); import("Binary_lib"); import("Sql_lib"); newWhere("BULKMAILRECIPIENT.BULKMAIL_ID", "$local.uid").deleteData(); -SingleBinaryUtils.remove("BULKMAIL", "DOCUMENT", vars.get("$local.uid")); \ No newline at end of file +SingleBinaryUtils.remove("BULKMAIL", "DOCUMENT", vars.get("$local.uid")); + +WorkflowSignalSender.deleted(); \ No newline at end of file diff --git a/entity/BulkMail_entity/recordcontainers/db/onDBInsert.js b/entity/BulkMail_entity/recordcontainers/db/onDBInsert.js index 37e06209f5..d1cc3f17cb 100644 --- a/entity/BulkMail_entity/recordcontainers/db/onDBInsert.js +++ b/entity/BulkMail_entity/recordcontainers/db/onDBInsert.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("Binary_lib"); import("Sql_lib"); import("DocumentTemplate_lib"); @@ -49,4 +50,6 @@ if (vars.getString("$param.PresetRecipients_param")) contactIds = contactIds.concat(JSON.parse(vars.getString("$param.PresetRecipients_param"))); if (contactIds && contactIds.length > 0) - BulkMailUtils.addRecipients(bulkMailId, BulkMailUtils.filterNewRecipients(bulkMailId, contactIds)); \ No newline at end of file + BulkMailUtils.addRecipients(bulkMailId, BulkMailUtils.filterNewRecipients(bulkMailId, contactIds)); + +WorkflowSignalSender.inserted(); \ No newline at end of file diff --git a/entity/BulkMail_entity/recordcontainers/db/onDBUpdate.js b/entity/BulkMail_entity/recordcontainers/db/onDBUpdate.js index 8ab7f06fd9..08049ff49d 100644 --- a/entity/BulkMail_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/BulkMail_entity/recordcontainers/db/onDBUpdate.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("system.util"); import("Binary_lib"); import("system.neon"); @@ -31,4 +32,6 @@ if (template && template.content && BulkMailUtils.isValidTemplateType(template.t SingleBinaryUtils.set("BULKMAIL", "DOCUMENT", vars.get("$local.uid"), template.content, template.filename); neon.refresh(["$field.content"]); -} \ No newline at end of file +} + +WorkflowSignalSender.updated(); \ No newline at end of file diff --git a/entity/CampaignStep_entity/CampaignStep_entity.aod b/entity/CampaignStep_entity/CampaignStep_entity.aod index afa04d270e..81199f0672 100644 --- a/entity/CampaignStep_entity/CampaignStep_entity.aod +++ b/entity/CampaignStep_entity/CampaignStep_entity.aod @@ -422,6 +422,9 @@ <alias>Data_alias</alias> <conditionProcess>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> + <onDBInsert>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/onDBInsert.js</onDBInsert> + <onDBUpdate>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/onDBUpdate.js</onDBUpdate> + <onDBDelete>%aditoprj%/entity/CampaignStep_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> <name>b039db2c-3988-42a0-9257-9689b1eb4e58</name> diff --git a/entity/CampaignStep_entity/recordcontainers/db/onDBDelete.js b/entity/CampaignStep_entity/recordcontainers/db/onDBDelete.js new file mode 100644 index 0000000000..6ff91a5eb3 --- /dev/null +++ b/entity/CampaignStep_entity/recordcontainers/db/onDBDelete.js @@ -0,0 +1,3 @@ +import("Workflow_lib"); + +WorkflowSignalSender.deleted(); \ No newline at end of file diff --git a/entity/CampaignStep_entity/recordcontainers/db/onDBInsert.js b/entity/CampaignStep_entity/recordcontainers/db/onDBInsert.js new file mode 100644 index 0000000000..54f0349c9f --- /dev/null +++ b/entity/CampaignStep_entity/recordcontainers/db/onDBInsert.js @@ -0,0 +1,3 @@ +import("Workflow_lib"); + +WorkflowSignalSender.inserted(); \ No newline at end of file diff --git a/entity/CampaignStep_entity/recordcontainers/db/onDBUpdate.js b/entity/CampaignStep_entity/recordcontainers/db/onDBUpdate.js new file mode 100644 index 0000000000..2e53f3cad9 --- /dev/null +++ b/entity/CampaignStep_entity/recordcontainers/db/onDBUpdate.js @@ -0,0 +1,3 @@ +import("Workflow_lib"); + +WorkflowSignalSender.updated(); \ No newline at end of file diff --git a/entity/Campaign_entity/Campaign_entity.aod b/entity/Campaign_entity/Campaign_entity.aod index 497702f337..d67763b95c 100644 --- a/entity/Campaign_entity/Campaign_entity.aod +++ b/entity/Campaign_entity/Campaign_entity.aod @@ -524,6 +524,7 @@ <alias>Data_alias</alias> <conditionProcess>%aditoprj%/entity/Campaign_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <onDBInsert>%aditoprj%/entity/Campaign_entity/recordcontainers/db/onDBInsert.js</onDBInsert> + <onDBUpdate>%aditoprj%/entity/Campaign_entity/recordcontainers/db/onDBUpdate.js</onDBUpdate> <onDBDelete>%aditoprj%/entity/Campaign_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> diff --git a/entity/Campaign_entity/recordcontainers/db/onDBDelete.js b/entity/Campaign_entity/recordcontainers/db/onDBDelete.js index 4a47111a89..43c0c22b88 100644 --- a/entity/Campaign_entity/recordcontainers/db/onDBDelete.js +++ b/entity/Campaign_entity/recordcontainers/db/onDBDelete.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("Context_lib"); import("system.db"); import("system.vars"); @@ -24,4 +25,6 @@ if (currentId) } new AttributeRelationQuery(currentId, null, ContextUtils.getCurrentContextId()) - .deleteAllAttributes(); \ No newline at end of file + .deleteAllAttributes(); + +WorkflowSignalSender.deleted(); \ No newline at end of file diff --git a/entity/Campaign_entity/recordcontainers/db/onDBInsert.js b/entity/Campaign_entity/recordcontainers/db/onDBInsert.js index 817ea9b70d..3c0830aabe 100644 --- a/entity/Campaign_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Campaign_entity/recordcontainers/db/onDBInsert.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("system.neon"); import("Employee_lib"); import("system.translate"); @@ -41,4 +42,6 @@ else dateStart, dateEnd, description, maxParticipants, state, sorting, employeeContactId]; db.insertData("CAMPAIGNSTEP", columns, null, values); -} \ No newline at end of file +} + +WorkflowSignalSender.inserted(); \ No newline at end of file diff --git a/entity/Campaign_entity/recordcontainers/db/onDBUpdate.js b/entity/Campaign_entity/recordcontainers/db/onDBUpdate.js new file mode 100644 index 0000000000..2e53f3cad9 --- /dev/null +++ b/entity/Campaign_entity/recordcontainers/db/onDBUpdate.js @@ -0,0 +1,3 @@ +import("Workflow_lib"); + +WorkflowSignalSender.updated(); \ No newline at end of file diff --git a/entity/Contract_entity/Contract_entity.aod b/entity/Contract_entity/Contract_entity.aod index 386f326ec1..e93a7dabbb 100644 --- a/entity/Contract_entity/Contract_entity.aod +++ b/entity/Contract_entity/Contract_entity.aod @@ -384,6 +384,8 @@ <fromClauseProcess>%aditoprj%/entity/Contract_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess> <conditionProcess>%aditoprj%/entity/Contract_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/Contract_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> + <onDBInsert>%aditoprj%/entity/Contract_entity/recordcontainers/db/onDBInsert.js</onDBInsert> + <onDBUpdate>%aditoprj%/entity/Contract_entity/recordcontainers/db/onDBUpdate.js</onDBUpdate> <onDBDelete>%aditoprj%/entity/Contract_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> diff --git a/entity/Contract_entity/recordcontainers/db/onDBDelete.js b/entity/Contract_entity/recordcontainers/db/onDBDelete.js index b9de11647b..9153bd6899 100644 --- a/entity/Contract_entity/recordcontainers/db/onDBDelete.js +++ b/entity/Contract_entity/recordcontainers/db/onDBDelete.js @@ -1,6 +1,9 @@ +import("Workflow_lib"); import("system.vars"); import("Context_lib"); import("Attribute_lib"); new AttributeRelationQuery(vars.get("$field.CONTRACTID"), null, ContextUtils.getCurrentContextId()) - .deleteAllAttributes(); \ No newline at end of file + .deleteAllAttributes(); + +WorkflowSignalSender.deleted(); \ No newline at end of file diff --git a/entity/Contract_entity/recordcontainers/db/onDBInsert.js b/entity/Contract_entity/recordcontainers/db/onDBInsert.js new file mode 100644 index 0000000000..54f0349c9f --- /dev/null +++ b/entity/Contract_entity/recordcontainers/db/onDBInsert.js @@ -0,0 +1,3 @@ +import("Workflow_lib"); + +WorkflowSignalSender.inserted(); \ No newline at end of file diff --git a/entity/Contract_entity/recordcontainers/db/onDBUpdate.js b/entity/Contract_entity/recordcontainers/db/onDBUpdate.js new file mode 100644 index 0000000000..2e53f3cad9 --- /dev/null +++ b/entity/Contract_entity/recordcontainers/db/onDBUpdate.js @@ -0,0 +1,3 @@ +import("Workflow_lib"); + +WorkflowSignalSender.updated(); \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/recordcontainers/db/onDBDelete.js b/entity/DocumentTemplate_entity/recordcontainers/db/onDBDelete.js index 8ecca18f87..e59e3a882a 100644 --- a/entity/DocumentTemplate_entity/recordcontainers/db/onDBDelete.js +++ b/entity/DocumentTemplate_entity/recordcontainers/db/onDBDelete.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("Context_lib"); import("Sql_lib"); import("system.vars"); @@ -12,4 +13,6 @@ if (binaryId) db.deleteBinary(binaryId, SqlUtils.getBinariesAlias()); new AttributeRelationQuery(vars.get("$field.DOCUMENTTEMPLATEID"), null, ContextUtils.getCurrentContextId()) - .deleteAllAttributes(); \ No newline at end of file + .deleteAllAttributes(); + +WorkflowSignalSender.deleted(); \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/recordcontainers/db/onDBInsert.js b/entity/DocumentTemplate_entity/recordcontainers/db/onDBInsert.js index 05dbb4ec89..3fcb0bfdea 100644 --- a/entity/DocumentTemplate_entity/recordcontainers/db/onDBInsert.js +++ b/entity/DocumentTemplate_entity/recordcontainers/db/onDBInsert.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("DocumentTemplate_lib"); import("system.vars"); import("Document_lib"); @@ -6,4 +7,6 @@ var rowdata = vars.get("$local.rowdata"); var upload = new FileUpload(vars.get("$field.BINDATA")); var rowId = vars.get("$local.uid"); -DocumentTemplateUtils.insertTemplateData(rowId, upload, rowdata["DOCUMENTTEMPLATE.KIND"], vars.get("$field.Content"), rowdata["DOCUMENTTEMPLATE.CLASSIFICATION"], rowdata["DOCUMENTTEMPLATE.NAME"]); \ No newline at end of file +DocumentTemplateUtils.insertTemplateData(rowId, upload, rowdata["DOCUMENTTEMPLATE.KIND"], vars.get("$field.Content"), rowdata["DOCUMENTTEMPLATE.CLASSIFICATION"], rowdata["DOCUMENTTEMPLATE.NAME"]); + +WorkflowSignalSender.inserted(); \ No newline at end of file diff --git a/entity/DocumentTemplate_entity/recordcontainers/db/onDBUpdate.js b/entity/DocumentTemplate_entity/recordcontainers/db/onDBUpdate.js index 8cf4c2ee76..a3311749b1 100644 --- a/entity/DocumentTemplate_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/DocumentTemplate_entity/recordcontainers/db/onDBUpdate.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("DocumentTemplate_lib"); import("system.vars"); import("Document_lib"); @@ -7,4 +8,6 @@ var content = vars.get("$field.Content"); var upload = new FileUpload(vars.get("$field.BINDATA")); var rowId = vars.get("$local.uid"); -DocumentTemplateUtils.updateTemplateData(rowId, upload, rowdata["DOCUMENTTEMPLATE.KIND"], content, rowdata["DOCUMENTTEMPLATE.CLASSIFICATION"], rowdata["DOCUMENTTEMPLATE.NAME"]); \ No newline at end of file +DocumentTemplateUtils.updateTemplateData(rowId, upload, rowdata["DOCUMENTTEMPLATE.KIND"], content, rowdata["DOCUMENTTEMPLATE.CLASSIFICATION"], rowdata["DOCUMENTTEMPLATE.NAME"]); + +WorkflowSignalSender.updated(); \ No newline at end of file diff --git a/entity/Employee_entity/recordcontainers/jdito/onDelete.js b/entity/Employee_entity/recordcontainers/jdito/onDelete.js index 05394e349d..0dc6052548 100644 --- a/entity/Employee_entity/recordcontainers/jdito/onDelete.js +++ b/entity/Employee_entity/recordcontainers/jdito/onDelete.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("Context_lib"); import("Attribute_lib"); import("system.neon"); @@ -12,4 +13,6 @@ if (EmployeeUtils.getCurrentUserName() != vars.get("$field.TITLE") && !EmployeeU AttributeRelationQuery(EmployeeUtils.sliceUserId(vars.get("$field.UID")), null, ContextUtils.getCurrentContextId()) .deleteAllAttributes(); + + WorkflowSignalSender.deleted(); } \ No newline at end of file diff --git a/entity/Employee_entity/recordcontainers/jdito/onInsert.js b/entity/Employee_entity/recordcontainers/jdito/onInsert.js index de0e6ff52d..4ad2125ac5 100644 --- a/entity/Employee_entity/recordcontainers/jdito/onInsert.js +++ b/entity/Employee_entity/recordcontainers/jdito/onInsert.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("system.neon"); import("system.vars"); import("system.tools"); @@ -24,4 +25,6 @@ if (rowdata["PASSWORD.value"] && rowdata["PASSWORD.value"] == rowdata["CONFIRM_P { user[tools.PASSWORD] = rowdata["PASSWORD.value"]; } -tools.insertUser(user, rowdata["UID.value"]); \ No newline at end of file +tools.insertUser(user, rowdata["UID.value"]); + +WorkflowSignalSender.inserted(); \ No newline at end of file diff --git a/entity/Employee_entity/recordcontainers/jdito/onUpdate.js b/entity/Employee_entity/recordcontainers/jdito/onUpdate.js index 09e4945bb5..0bf72a6889 100644 --- a/entity/Employee_entity/recordcontainers/jdito/onUpdate.js +++ b/entity/Employee_entity/recordcontainers/jdito/onUpdate.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("Sql_lib"); import("system.db"); import("system.vars"); @@ -38,4 +39,6 @@ if (vars.exists("$param.PasswordChange_param") && vars.get("$param.PasswordChang user[tools.PASSWORD] = rowdata["PASSWORD.value"]; } -tools.updateUser(user); \ No newline at end of file +tools.updateUser(user); + +WorkflowSignalSender.updated(); \ No newline at end of file diff --git a/entity/LetterRecipient_entity/LetterRecipient_entity.aod b/entity/LetterRecipient_entity/LetterRecipient_entity.aod index 4fb6e99ca2..0aada1984f 100644 --- a/entity/LetterRecipient_entity/LetterRecipient_entity.aod +++ b/entity/LetterRecipient_entity/LetterRecipient_entity.aod @@ -105,6 +105,9 @@ <fromClauseProcess>%aditoprj%/entity/LetterRecipient_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess> <conditionProcess>%aditoprj%/entity/LetterRecipient_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/LetterRecipient_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> + <onDBInsert>%aditoprj%/entity/LetterRecipient_entity/recordcontainers/db/onDBInsert.js</onDBInsert> + <onDBUpdate>%aditoprj%/entity/LetterRecipient_entity/recordcontainers/db/onDBUpdate.js</onDBUpdate> + <onDBDelete>%aditoprj%/entity/LetterRecipient_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> <name>0a41cbd3-c199-4191-af95-ba793e4f2554</name> diff --git a/entity/LetterRecipient_entity/recordcontainers/db/onDBDelete.js b/entity/LetterRecipient_entity/recordcontainers/db/onDBDelete.js new file mode 100644 index 0000000000..6ff91a5eb3 --- /dev/null +++ b/entity/LetterRecipient_entity/recordcontainers/db/onDBDelete.js @@ -0,0 +1,3 @@ +import("Workflow_lib"); + +WorkflowSignalSender.deleted(); \ No newline at end of file diff --git a/entity/LetterRecipient_entity/recordcontainers/db/onDBInsert.js b/entity/LetterRecipient_entity/recordcontainers/db/onDBInsert.js new file mode 100644 index 0000000000..54f0349c9f --- /dev/null +++ b/entity/LetterRecipient_entity/recordcontainers/db/onDBInsert.js @@ -0,0 +1,3 @@ +import("Workflow_lib"); + +WorkflowSignalSender.inserted(); \ No newline at end of file diff --git a/entity/LetterRecipient_entity/recordcontainers/db/onDBUpdate.js b/entity/LetterRecipient_entity/recordcontainers/db/onDBUpdate.js new file mode 100644 index 0000000000..2e53f3cad9 --- /dev/null +++ b/entity/LetterRecipient_entity/recordcontainers/db/onDBUpdate.js @@ -0,0 +1,3 @@ +import("Workflow_lib"); + +WorkflowSignalSender.updated(); \ No newline at end of file diff --git a/entity/Offer_entity/afterOperatingState.js b/entity/Offer_entity/afterOperatingState.js index 39f9de2bc2..d80259f9b7 100644 --- a/entity/Offer_entity/afterOperatingState.js +++ b/entity/Offer_entity/afterOperatingState.js @@ -6,5 +6,4 @@ if (vars.exists("$context.workflowQueue") && vars.get("$context.workflowQueue")) { WorkflowStarter.inserted(vars.get("$context.workflowQueue")); vars.set("$context.workflowQueue", null); -} -WorkflowSignalSender.throwQueuedEvents(); \ No newline at end of file +} \ No newline at end of file diff --git a/entity/Offer_entity/recordcontainers/db/onDBInsert.js b/entity/Offer_entity/recordcontainers/db/onDBInsert.js index f65c655ec8..abaadff690 100644 --- a/entity/Offer_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Offer_entity/recordcontainers/db/onDBInsert.js @@ -23,4 +23,4 @@ if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) //start the execution in afterOperatingState, because here the dataset is not yet inserted vars.set("$context.workflowQueue", {sum : Number(vars.get("$field.TotalGross")), status : vars.get("$field.STATUS")}); -WorkflowSignalSender.markInserted(); +WorkflowSignalSender.inserted(); diff --git a/entity/Offer_entity/recordcontainers/db/onDBUpdate.js b/entity/Offer_entity/recordcontainers/db/onDBUpdate.js index 481f3bcd1a..d278b4ce87 100644 --- a/entity/Offer_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Offer_entity/recordcontainers/db/onDBUpdate.js @@ -7,4 +7,4 @@ var status = vars.get("$local.rowdata")["OFFER.STATUS"]; if (vars.get("$local.changed").indexOf("OFFER.STATUS") !== -1 && status == $KeywordRegistry.offerStatus$toCheck()) WorkflowStarter.updated({sum : Number(vars.get("$field.TotalGross")), status : status}); -WorkflowSignalSender.markUpdated(); \ No newline at end of file +WorkflowSignalSender.updated(); \ No newline at end of file diff --git a/entity/Order_entity/Order_entity.aod b/entity/Order_entity/Order_entity.aod index 131320869c..4394b20365 100644 --- a/entity/Order_entity/Order_entity.aod +++ b/entity/Order_entity/Order_entity.aod @@ -989,6 +989,7 @@ <conditionProcess>%aditoprj%/entity/Order_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/Order_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> <onDBInsert>%aditoprj%/entity/Order_entity/recordcontainers/db/onDBInsert.js</onDBInsert> + <onDBUpdate>%aditoprj%/entity/Order_entity/recordcontainers/db/onDBUpdate.js</onDBUpdate> <onDBDelete>%aditoprj%/entity/Order_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> diff --git a/entity/Order_entity/recordcontainers/db/onDBDelete.js b/entity/Order_entity/recordcontainers/db/onDBDelete.js index 9d21e31224..7da0b19fe0 100644 --- a/entity/Order_entity/recordcontainers/db/onDBDelete.js +++ b/entity/Order_entity/recordcontainers/db/onDBDelete.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("Context_lib"); import("system.vars"); import("Sql_lib"); @@ -6,4 +7,6 @@ import("Attribute_lib"); newWhere("SALESORDERITEM.SALESORDER_ID", "$field.SALESORDERID").deleteData(); new AttributeRelationQuery(vars.get("$field.SALESORDERID"), null, ContextUtils.getCurrentContextId()) - .deleteAllAttributes(); \ No newline at end of file + .deleteAllAttributes(); + +WorkflowSignalSender.deleted(); \ No newline at end of file diff --git a/entity/Order_entity/recordcontainers/db/onDBInsert.js b/entity/Order_entity/recordcontainers/db/onDBInsert.js index 0babcfe31d..8e0f20e857 100644 --- a/entity/Order_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Order_entity/recordcontainers/db/onDBInsert.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("Order_lib"); import("system.neon"); import("system.vars"); @@ -5,3 +6,5 @@ import("system.vars"); //@TODO: OfferId_param is also set by 'copy order' -> the items of the offer are copied. What should happen? if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.exists("$param.OfferId_param")) OrderUtils.copyOfferItemsToOrder(vars.getString("$param.OfferId_param"), vars.get("$local.rowdata")["SALESORDER.SALESORDERID"]); + +WorkflowSignalSender.inserted(); \ No newline at end of file diff --git a/entity/Order_entity/recordcontainers/db/onDBUpdate.js b/entity/Order_entity/recordcontainers/db/onDBUpdate.js new file mode 100644 index 0000000000..2e53f3cad9 --- /dev/null +++ b/entity/Order_entity/recordcontainers/db/onDBUpdate.js @@ -0,0 +1,3 @@ +import("Workflow_lib"); + +WorkflowSignalSender.updated(); \ No newline at end of file diff --git a/entity/Organisation_entity/afterOperatingState.js b/entity/Organisation_entity/afterOperatingState.js index bd1093a1fb..95c2733509 100644 --- a/entity/Organisation_entity/afterOperatingState.js +++ b/entity/Organisation_entity/afterOperatingState.js @@ -5,5 +5,4 @@ if (vars.exists("$context.workflowQueue") && vars.get("$context.workflowQueue")) { WorkflowStarter.inserted(vars.get("$context.workflowQueue")); vars.set("$context.workflowQueue", null); -} -WorkflowSignalSender.throwQueuedEvents(); +} \ 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 1467c8c8de..3171f7e09c 100644 --- a/entity/Organisation_entity/recordcontainers/db/onDBDelete.js +++ b/entity/Organisation_entity/recordcontainers/db/onDBDelete.js @@ -17,4 +17,4 @@ newWhere("ADDRESS.CONTACT_ID", contactId).deleteData(); newWhere("COMMRESTRICTION.CONTACT_ID", contactId).deleteData(); //WorkflowStarter.deleted(); -//WorkflowSignalSender.deleted(); \ No newline at end of file +WorkflowSignalSender.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 index f4265e2aa5..e0e9130860 100644 --- a/entity/Organisation_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Organisation_entity/recordcontainers/db/onDBInsert.js @@ -3,4 +3,4 @@ import("system.vars"); //start the execution in afterOperatingState, because here the dataset is not yet inserted vars.set("$context.workflowQueue", {}); -WorkflowSignalSender.markInserted(); \ No newline at end of file +WorkflowSignalSender.inserted(); \ 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 166750a8ae..5b073c2fbe 100644 --- a/entity/Organisation_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Organisation_entity/recordcontainers/db/onDBUpdate.js @@ -16,4 +16,4 @@ FieldChanges.assimilateChangeAndDispose("$field.STANDARD_PHONE_COMMUNICATION", f }); WorkflowStarter.updated(); -WorkflowSignalSender.markUpdated(); \ No newline at end of file +WorkflowSignalSender.updated(); \ No newline at end of file diff --git a/entity/Person_entity/afterOperatingState.js b/entity/Person_entity/afterOperatingState.js index a246813efb..95c2733509 100644 --- a/entity/Person_entity/afterOperatingState.js +++ b/entity/Person_entity/afterOperatingState.js @@ -5,5 +5,4 @@ if (vars.exists("$context.workflowQueue") && vars.get("$context.workflowQueue")) { WorkflowStarter.inserted(vars.get("$context.workflowQueue")); vars.set("$context.workflowQueue", null); -} -WorkflowSignalSender.throwQueuedEvents(); \ No newline at end of file +} \ 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 5f8eff3e5b..62d6a3e6da 100644 --- a/entity/Person_entity/recordcontainers/db/onDBDelete.js +++ b/entity/Person_entity/recordcontainers/db/onDBDelete.js @@ -16,4 +16,4 @@ newWhere("ADDRESS.CONTACT_ID", contactId).deleteData(); newWhere("COMMRESTRICTION.CONTACT_ID", contactId).deleteData(); //WorkflowStarter.deleted(); -//WorkflowSignalSender.deleted(); \ No newline at end of file +WorkflowSignalSender.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 c9a099d7e3..650231513d 100644 --- a/entity/Person_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Person_entity/recordcontainers/db/onDBInsert.js @@ -11,7 +11,7 @@ DataPrivacyUtils.notifyNeedDataPrivacyUpdate(contactId); //start the execution in afterOperatingState, because here the dataset is not yet inserted vars.set("$context.workflowQueue", {}); -WorkflowSignalSender.markInserted(); +WorkflowSignalSender.inserted(); //let valuesToCheck = {}; // diff --git a/entity/Person_entity/recordcontainers/db/onDBUpdate.js b/entity/Person_entity/recordcontainers/db/onDBUpdate.js index b62e00ce63..4268b8a017 100644 --- a/entity/Person_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Person_entity/recordcontainers/db/onDBUpdate.js @@ -44,4 +44,4 @@ vars.get("$local.changed").forEach(function(fieldName) DataPrivacyUtils.notifyNeedDataPrivacyUpdate(uid); WorkflowStarter.updated(); -WorkflowSignalSender.markUpdated(); \ No newline at end of file +WorkflowSignalSender.updated(); \ No newline at end of file diff --git a/entity/Product_entity/Product_entity.aod b/entity/Product_entity/Product_entity.aod index 07cb0b0551..d2f1363569 100644 --- a/entity/Product_entity/Product_entity.aod +++ b/entity/Product_entity/Product_entity.aod @@ -462,6 +462,7 @@ <fromClauseProcess>%aditoprj%/entity/Product_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess> <conditionProcess>%aditoprj%/entity/Product_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/Product_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> + <onDBInsert>%aditoprj%/entity/Product_entity/recordcontainers/db/onDBInsert.js</onDBInsert> <onDBUpdate>%aditoprj%/entity/Product_entity/recordcontainers/db/onDBUpdate.js</onDBUpdate> <onDBDelete>%aditoprj%/entity/Product_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> diff --git a/entity/Product_entity/recordcontainers/db/onDBDelete.js b/entity/Product_entity/recordcontainers/db/onDBDelete.js index 0ab63616f1..7fe2819a4d 100644 --- a/entity/Product_entity/recordcontainers/db/onDBDelete.js +++ b/entity/Product_entity/recordcontainers/db/onDBDelete.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("Context_lib"); import("Sql_lib"); import("Attribute_lib"); @@ -15,4 +16,6 @@ newWhereIfSet("STOCK.PRODUCT_ID", "$field.PRODUCTID") .deleteData(); new AttributeRelationQuery(productId, null, ContextUtils.getCurrentContextId()) - .deleteAllAttributes(); \ No newline at end of file + .deleteAllAttributes(); + +WorkflowSignalSender.deleted(); \ No newline at end of file diff --git a/entity/Product_entity/recordcontainers/db/onDBInsert.js b/entity/Product_entity/recordcontainers/db/onDBInsert.js new file mode 100644 index 0000000000..54f0349c9f --- /dev/null +++ b/entity/Product_entity/recordcontainers/db/onDBInsert.js @@ -0,0 +1,3 @@ +import("Workflow_lib"); + +WorkflowSignalSender.inserted(); \ No newline at end of file diff --git a/entity/Product_entity/recordcontainers/db/onDBUpdate.js b/entity/Product_entity/recordcontainers/db/onDBUpdate.js index c9c792deeb..01a6d02f7e 100644 --- a/entity/Product_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Product_entity/recordcontainers/db/onDBUpdate.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("system.vars"); import("Product_lib"); import("Entity_lib"); @@ -9,3 +10,5 @@ FieldChanges.assimilateChangeAndDispose("$field.IMAGE", function(state, value){ else ProductUtils.removeImage(vars.get("$local.uid")); }); + +WorkflowSignalSender.updated(); \ 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 93d6a35c5e..aa9041d3bd 100644 --- a/entity/Salesproject_entity/recordcontainers/db/onDBDelete.js +++ b/entity/Salesproject_entity/recordcontainers/db/onDBDelete.js @@ -44,4 +44,5 @@ if (currentId) new AttributeRelationQuery(currentId, null, ContextUtils.getCurrentContextId()) .deleteAllAttributes(); -WorkflowStarter.deleted(); \ No newline at end of file +WorkflowStarter.deleted(); +WorkflowSignalSender.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 f083e30bb6..ac292d8633 100644 --- a/entity/Salesproject_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Salesproject_entity/recordcontainers/db/onDBInsert.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("Context_lib"); import("Attribute_lib"); import("AttributeRegistry_basic"); @@ -16,4 +17,5 @@ if (vars.get("$field.PROJECTTYPE")) } //start the execution in afterOperatingState, because here the dataset is not yet inserted -vars.set("$context.workflowQueue", {}); \ No newline at end of file +vars.set("$context.workflowQueue", {}); +WorkflowSignalSender.inserted(); \ 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 3cfb1b47ba..351ca78b95 100644 --- a/entity/Salesproject_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Salesproject_entity/recordcontainers/db/onDBUpdate.js @@ -101,6 +101,7 @@ if (needToUpdateForecast) Salesproject.notifyToUpdateForecast(); WorkflowStarter.updated(); +WorkflowSignalSender.updated(); neon.refreshAll(); diff --git a/entity/SerialLetter_entity/recordcontainers/db/onDBDelete.js b/entity/SerialLetter_entity/recordcontainers/db/onDBDelete.js index 2a7c513ef7..c32172ac6b 100644 --- a/entity/SerialLetter_entity/recordcontainers/db/onDBDelete.js +++ b/entity/SerialLetter_entity/recordcontainers/db/onDBDelete.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("system.vars"); import("Binary_lib"); import("Sql_lib"); @@ -6,4 +7,6 @@ newWhere("LETTERRECIPIENT.SERIALLETTER_ID", "$local.uid").deleteData(); var uid = vars.get("$local.uid"); SingleBinaryUtils.remove("SERIALLETTER", "DOCUMENT", uid); -SingleBinaryUtils.remove("SERIALLETTER", "SERIALLETTERFILE", uid); \ No newline at end of file +SingleBinaryUtils.remove("SERIALLETTER", "SERIALLETTERFILE", uid); + +WorkflowSignalSender.deleted(); \ No newline at end of file diff --git a/entity/SerialLetter_entity/recordcontainers/db/onDBInsert.js b/entity/SerialLetter_entity/recordcontainers/db/onDBInsert.js index b22db28618..408cbf0666 100644 --- a/entity/SerialLetter_entity/recordcontainers/db/onDBInsert.js +++ b/entity/SerialLetter_entity/recordcontainers/db/onDBInsert.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("Binary_lib"); import("Sql_lib"); import("DocumentTemplate_lib"); @@ -15,4 +16,6 @@ var template = DocumentTemplate.fromUpload(bindata); if (template.content) { SingleBinaryUtils.insert("SERIALLETTER", "SERIALLETTERFILE", letterId, template.content, template.filename, ""); -} \ No newline at end of file +} + +WorkflowSignalSender.inserted(); \ No newline at end of file diff --git a/entity/SerialLetter_entity/recordcontainers/db/onDBUpdate.js b/entity/SerialLetter_entity/recordcontainers/db/onDBUpdate.js index 4dd6439a02..9b94cb4320 100644 --- a/entity/SerialLetter_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/SerialLetter_entity/recordcontainers/db/onDBUpdate.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("Binary_lib"); import("system.neon"); import("Sql_lib"); @@ -20,3 +21,5 @@ if (template.content) neon.refresh(["$field.content"]); } + +WorkflowSignalSender.updated(); \ No newline at end of file diff --git a/entity/SupportTicket_entity/SupportTicket_entity.aod b/entity/SupportTicket_entity/SupportTicket_entity.aod index a52c6af751..f1320203bf 100644 --- a/entity/SupportTicket_entity/SupportTicket_entity.aod +++ b/entity/SupportTicket_entity/SupportTicket_entity.aod @@ -405,6 +405,7 @@ <conditionProcess>%aditoprj%/entity/SupportTicket_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/SupportTicket_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> <onDBInsert>%aditoprj%/entity/SupportTicket_entity/recordcontainers/db/onDBInsert.js</onDBInsert> + <onDBUpdate>%aditoprj%/entity/SupportTicket_entity/recordcontainers/db/onDBUpdate.js</onDBUpdate> <onDBDelete>%aditoprj%/entity/SupportTicket_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> diff --git a/entity/SupportTicket_entity/recordcontainers/db/onDBDelete.js b/entity/SupportTicket_entity/recordcontainers/db/onDBDelete.js index 607773386a..78bd440b5d 100644 --- a/entity/SupportTicket_entity/recordcontainers/db/onDBDelete.js +++ b/entity/SupportTicket_entity/recordcontainers/db/onDBDelete.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("Context_lib"); import("system.vars"); import("Attribute_lib"); @@ -6,4 +7,6 @@ import("Sql_lib"); newWhereIfSet("TASKLINK.TASK_ID", "$field.TASK_TASKID").deleteData(); new AttributeRelationQuery(vars.get("$field.TICKETID"), null, ContextUtils.getCurrentContextId()) - .deleteAllAttributes(); \ No newline at end of file + .deleteAllAttributes(); + +WorkflowSignalSender.deleted(); \ No newline at end of file diff --git a/entity/SupportTicket_entity/recordcontainers/db/onDBInsert.js b/entity/SupportTicket_entity/recordcontainers/db/onDBInsert.js index 2d6454962c..c7eaf9c304 100644 --- a/entity/SupportTicket_entity/recordcontainers/db/onDBInsert.js +++ b/entity/SupportTicket_entity/recordcontainers/db/onDBInsert.js @@ -1,6 +1,9 @@ +import("Workflow_lib"); import("Util_lib"); import("system.vars"); import("system.db"); import("ActivityTask_lib") -ConsecutiveCodeUtils.setCode(vars.get("$local.uid"), "TICKET", "TICKETID", "CODE"); \ No newline at end of file +ConsecutiveCodeUtils.setCode(vars.get("$local.uid"), "TICKET", "TICKETID", "CODE"); + +WorkflowSignalSender.inserted(); \ No newline at end of file diff --git a/entity/SupportTicket_entity/recordcontainers/db/onDBUpdate.js b/entity/SupportTicket_entity/recordcontainers/db/onDBUpdate.js new file mode 100644 index 0000000000..2e53f3cad9 --- /dev/null +++ b/entity/SupportTicket_entity/recordcontainers/db/onDBUpdate.js @@ -0,0 +1,3 @@ +import("Workflow_lib"); + +WorkflowSignalSender.updated(); \ No newline at end of file diff --git a/entity/Task_entity/Task_entity.aod b/entity/Task_entity/Task_entity.aod index 3b1187221c..28aaf1ff3a 100644 --- a/entity/Task_entity/Task_entity.aod +++ b/entity/Task_entity/Task_entity.aod @@ -449,6 +449,8 @@ <alias>Data_alias</alias> <conditionProcess>%aditoprj%/entity/Task_entity/recordcontainers/db/conditionProcess.js</conditionProcess> <orderClauseProcess>%aditoprj%/entity/Task_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> + <onDBInsert>%aditoprj%/entity/Task_entity/recordcontainers/db/onDBInsert.js</onDBInsert> + <onDBUpdate>%aditoprj%/entity/Task_entity/recordcontainers/db/onDBUpdate.js</onDBUpdate> <onDBDelete>%aditoprj%/entity/Task_entity/recordcontainers/db/onDBDelete.js</onDBDelete> <linkInformation> <linkInformation> diff --git a/entity/Task_entity/recordcontainers/db/onDBDelete.js b/entity/Task_entity/recordcontainers/db/onDBDelete.js index 425af5bdc4..a59a05ae62 100644 --- a/entity/Task_entity/recordcontainers/db/onDBDelete.js +++ b/entity/Task_entity/recordcontainers/db/onDBDelete.js @@ -1,3 +1,6 @@ +import("Workflow_lib"); import("Sql_lib"); -newWhere("TASKLINK.TASK_ID", "$field.TASKID").deleteData(); \ No newline at end of file +newWhere("TASKLINK.TASK_ID", "$field.TASKID").deleteData(); + +WorkflowSignalSender.deleted(); \ No newline at end of file diff --git a/entity/Task_entity/recordcontainers/db/onDBInsert.js b/entity/Task_entity/recordcontainers/db/onDBInsert.js new file mode 100644 index 0000000000..54f0349c9f --- /dev/null +++ b/entity/Task_entity/recordcontainers/db/onDBInsert.js @@ -0,0 +1,3 @@ +import("Workflow_lib"); + +WorkflowSignalSender.inserted(); \ No newline at end of file diff --git a/entity/Task_entity/recordcontainers/db/onDBUpdate.js b/entity/Task_entity/recordcontainers/db/onDBUpdate.js new file mode 100644 index 0000000000..2e53f3cad9 --- /dev/null +++ b/entity/Task_entity/recordcontainers/db/onDBUpdate.js @@ -0,0 +1,3 @@ +import("Workflow_lib"); + +WorkflowSignalSender.updated(); \ No newline at end of file diff --git a/entity/WorkflowInstance_entity/recordcontainers/jdito/onInsert.js b/entity/WorkflowInstance_entity/recordcontainers/jdito/onInsert.js index 26b8378e6a..c2d4c9cd52 100644 --- a/entity/WorkflowInstance_entity/recordcontainers/jdito/onInsert.js +++ b/entity/WorkflowInstance_entity/recordcontainers/jdito/onInsert.js @@ -16,8 +16,8 @@ var instanceName = rowdata["NAME.value"]; var titlePlaceholder = "{title}"; var fetchContentTitle = instanceName && instanceName.includes(titlePlaceholder); -var targetId = variables[WorkflowCommonVariables.TARGET_ID()]; -var targetContext = variables[WorkflowCommonVariables.TARGET_CONTEXT()]; +var targetId = variables[WorkflowVariables.TARGET_ID()]; +var targetContext = variables[WorkflowVariables.TARGET_CONTEXT()]; var targetIds = []; if (Array.isArray(targetId) && targetId.length !== 0) { @@ -71,7 +71,7 @@ function _startForIds (pTargets, pVariables) { pTargets.forEach(function ([id, name]) { - pVariables[WorkflowCommonVariables.TARGET_ID()] = id; + pVariables[WorkflowVariables.TARGET_ID()] = id; var instanceId = workflow.startProcessByKey(processKey, pVariables); if (name) workflow.setProcessInstanceName(instanceId, name); diff --git a/entity/WorkflowSignal_entity/WorkflowSignal_entity.aod b/entity/WorkflowSignal_entity/WorkflowSignal_entity.aod index d1212bff5e..70792616c2 100644 --- a/entity/WorkflowSignal_entity/WorkflowSignal_entity.aod +++ b/entity/WorkflowSignal_entity/WorkflowSignal_entity.aod @@ -52,6 +52,16 @@ <entityName>Context_entity</entityName> <fieldName>Exclusive</fieldName> </dependency> + <children> + <entityParameter> + <name>Blacklist_param</name> + <valueProcess>%aditoprj%/entity/WorkflowSignal_entity/entityfields/contexts/children/blacklist_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>InvertBlacklist_param</name> + <valueProcess>%aditoprj%/entity/WorkflowSignal_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js</valueProcess> + </entityParameter> + </children> </entityConsumer> <entityConsumer> <name>TriggerKeyword</name> @@ -91,6 +101,13 @@ <name>ICON</name> <contentType>IMAGE</contentType> </entityField> + <entityField> + <name>VARIABLES</name> + <title>Variables</title> + <dropDownProcess>%aditoprj%/entity/WorkflowSignal_entity/entityfields/variables/dropDownProcess.js</dropDownProcess> + <selectionMode>MULTI</selectionMode> + <valueProcess>%aditoprj%/entity/WorkflowSignal_entity/entityfields/variables/valueProcess.js</valueProcess> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> @@ -141,6 +158,10 @@ <name>ICON.value</name> <expression>%aditoprj%/entity/WorkflowSignal_entity/recordcontainers/db/recordfieldmappings/icon.value/expression.js</expression> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>VARIABLES.value</name> + <recordfield>WORKFLOWSIGNAL.VARIABLES</recordfield> + </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> </recordContainers> diff --git a/entity/WorkflowSignal_entity/entityfields/contexts/children/blacklist_param/valueProcess.js b/entity/WorkflowSignal_entity/entityfields/contexts/children/blacklist_param/valueProcess.js new file mode 100644 index 0000000000..b8dcc60644 --- /dev/null +++ b/entity/WorkflowSignal_entity/entityfields/contexts/children/blacklist_param/valueProcess.js @@ -0,0 +1,22 @@ +import("system.result"); + +result.object([ + "Activity", + "BulkMail", + "BulkMailRecipient", + "Campaign", + "CampaignStep", + "Contract", + "DocumentTemplate", + "Employee", + "LetterRecipient", + "Offer", + "Order", + "Organisation", + "Person", + "Product", + "Salesproject", + "SerialLetter", + "SupportTicket", + "Task" +]); \ No newline at end of file diff --git a/entity/WorkflowSignal_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js b/entity/WorkflowSignal_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js new file mode 100644 index 0000000000..40effa0178 --- /dev/null +++ b/entity/WorkflowSignal_entity/entityfields/contexts/children/invertblacklist_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.string(true); \ No newline at end of file diff --git a/entity/WorkflowSignal_entity/entityfields/variables/dropDownProcess.js b/entity/WorkflowSignal_entity/entityfields/variables/dropDownProcess.js new file mode 100644 index 0000000000..9df9881e4f --- /dev/null +++ b/entity/WorkflowSignal_entity/entityfields/variables/dropDownProcess.js @@ -0,0 +1,10 @@ +import("Workflow_lib"); +import("system.translate"); +import("system.result"); + +var targetIdVar = WorkflowVariables.TARGET_ID(); +var targetContextVar = WorkflowVariables.TARGET_CONTEXT(); +result.object([ + [targetIdVar, targetIdVar], + [targetContextVar, targetContextVar] +]); \ No newline at end of file diff --git a/entity/WorkflowSignal_entity/entityfields/variables/valueProcess.js b/entity/WorkflowSignal_entity/entityfields/variables/valueProcess.js new file mode 100644 index 0000000000..49817c0945 --- /dev/null +++ b/entity/WorkflowSignal_entity/entityfields/variables/valueProcess.js @@ -0,0 +1,8 @@ +import("Workflow_lib"); +import("system.text"); +import("system.neon"); +import("system.vars"); +import("system.result"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) + result.string(text.encodeMS([WorkflowVariables.TARGET_ID(), WorkflowVariables.TARGET_CONTEXT()])); \ 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 3f0a86614d..de6e83f10c 100644 --- a/entity/WorkflowTask_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/WorkflowTask_entity/recordcontainers/jdito/contentProcess.js @@ -105,8 +105,8 @@ result.object((function () assigneeCache.get(task.assignee), task.dueDate ? Date.parse(task.dueDate).toString() : "", task.owner || "", - variables.targetContext || "", - variables.targetId || "", + variables[WorkflowVariables.TARGET_CONTEXT()] || "", + variables[WorkflowVariables.TARGET_ID()] || "", task.claimTime || "", task.active || "false", task.priority || "", diff --git a/neonView/WorkflowSignalEdit_view/WorkflowSignalEdit_view.aod b/neonView/WorkflowSignalEdit_view/WorkflowSignalEdit_view.aod index fede712b90..145d17fe5d 100644 --- a/neonView/WorkflowSignalEdit_view/WorkflowSignalEdit_view.aod +++ b/neonView/WorkflowSignalEdit_view/WorkflowSignalEdit_view.aod @@ -30,6 +30,10 @@ <name>648536a5-2327-433e-8867-a3d60a0f8787</name> <entityField>OBJECT_CONDITION</entityField> </entityFieldLink> + <entityFieldLink> + <name>4bcf3490-5d3e-4c14-88c0-b0c7ffd54b73</name> + <entityField>VARIABLES</entityField> + </entityFieldLink> </fields> </genericViewTemplate> </children> diff --git a/process/CreateNotification_workflowService/CreateNotification_workflowService.aod b/process/CreateNotification_workflowService/CreateNotification_workflowService.aod index 06a5772980..e6455f2cd5 100644 --- a/process/CreateNotification_workflowService/CreateNotification_workflowService.aod +++ b/process/CreateNotification_workflowService/CreateNotification_workflowService.aod @@ -5,6 +5,7 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <documentation>%aditoprj%/process/CreateNotification_workflowService/documentation.adoc</documentation> <process>%aditoprj%/process/CreateNotification_workflowService/process.js</process> + <alias>_____SYSTEMALIAS</alias> <serviceTaskParameterProcess>%aditoprj%/process/CreateNotification_workflowService/serviceTaskParameterProcess.js</serviceTaskParameterProcess> <variants> <element>WORKFLOW</element> diff --git a/process/CreateNotification_workflowService/process.js b/process/CreateNotification_workflowService/process.js index 867554f841..458f665d71 100644 --- a/process/CreateNotification_workflowService/process.js +++ b/process/CreateNotification_workflowService/process.js @@ -5,7 +5,7 @@ var variables = JSON.parse(vars.get("$local.value")); var config = notification.createConfig() .notificationType("WorkflowNotification") - .addUsersWithIds([variables.notificationUsers || variables.USER_ID]) + .addUsersWithIds([variables.notificationUser || variables.USER_ID]) .initialState(notification.STATE_UNSEEN) .caption(variables.notificationCaption || "") .description(variables.notificationDescription || ""); diff --git a/process/Workflow_lib/process.js b/process/Workflow_lib/process.js index 6e07676e80..39b2bdb10b 100644 --- a/process/Workflow_lib/process.js +++ b/process/Workflow_lib/process.js @@ -1,3 +1,4 @@ +import("system.text"); import("system.logging"); import("system.project"); import("Sql_lib"); @@ -44,11 +45,11 @@ WorkflowUtils.openNewInstance = function (pVariables, pTargetId, pTargetContext, if (!pVariables) pVariables = {}; - Object.assign(pVariables, WorkflowCommonVariables.getTargetVariables(pTargetId, pTargetContext)); + Object.assign(pVariables, WorkflowVariables.getTargetVariables(pTargetId, pTargetContext)); neon.openContext("WorkflowInstance", null, null, neon.OPERATINGSTATE_NEW, { "ProcessVariables_param" : JSON.stringify(pVariables), - "TargetContext_param" : pVariables.targetContext, + "TargetContext_param" : pVariables[WorkflowVariables.TARGET_CONTEXT()], "TargetIdFilter_param" : pSelectionFilter ? JSON.stringify(pSelectionFilter) : "" }); } @@ -124,7 +125,7 @@ WorkflowStarter._startProcessByAction = function (pAction, pVariables, pTargetId if (!pVariables) pVariables = {}; - Object.assign(pVariables, WorkflowCommonVariables.getTargetVariables(pTargetId, pTargetContext)); + Object.assign(pVariables, WorkflowVariables.getTargetVariables(pTargetId, pTargetContext)); var context = pVariables.targetContext; WorkflowUtils.getPossibleWorkflowDefinitions(context, pAction).forEach(function (processKey) @@ -171,10 +172,9 @@ WorkflowSignalSender.EVENT_DELETE = function () * @param {String} pTargetId uid of the inserted dataset * @param {String} pTargetContext context of the inserted dataset */ -WorkflowSignalSender.markInserted = function (pTargetId, pTargetContext) +WorkflowSignalSender.inserted = function (pTargetId, pTargetContext) { - //TODO: is a signal like 'before insert' required? - WorkflowSignalSender._addToQueue(WorkflowSignalSender.EVENT_INSERT(), pTargetId, pTargetContext); + WorkflowSignalSender.eventHappened(WorkflowSignalSender.EVENT_INSERT(), pTargetId, pTargetContext); } /** @@ -184,49 +184,9 @@ WorkflowSignalSender.markInserted = function (pTargetId, pTargetContext) * @param {String} pTargetId uid of the updated dataset * @param {String} pTargetContext context of the updated dataset */ -WorkflowSignalSender.markUpdated = function (pTargetId, pTargetContext) +WorkflowSignalSender.updated = function (pTargetId, pTargetContext) { - WorkflowSignalSender._addToQueue(WorkflowSignalSender.EVENT_UPDATE(), pTargetId, pTargetContext); -} - -/** - * constant for the context variable for queueing events - */ -WorkflowSignalSender._QUEUE_VARNAME = function () -{ - return "$context.workflowSignalQueue"; -} - -/** - * adds events to the queue-context-variable to be evaluated later - */ -WorkflowSignalSender._addToQueue = function (pEvent, pTargetId, pTargetContext) -{ - var contextVar = WorkflowSignalSender._QUEUE_VARNAME(); - var queue = []; - if (vars.exists(contextVar) && vars.get(contextVar)) - queue = vars.get(contextVar); - - queue.push([pEvent, pTargetId, pTargetContext]); - vars.set(contextVar, queue); -} - -/** - * Evaluates the queued events in the context-variable and throws the events. That can result in workflow signals being thrown. - * This queueing can be used if something happens in a context, but the signal should not be thrown immediately (e. g. in the onInsert process - * of the recordcontainer, when the insert isn't finished). - */ -WorkflowSignalSender.throwQueuedEvents = function () -{ - var contextVar = WorkflowSignalSender._QUEUE_VARNAME(); - if (vars.exists(contextVar) && vars.get(contextVar)) - { - vars.get(contextVar).forEach(function (action) - { - WorkflowSignalSender.eventHappened.apply(null, action); - }); - vars.set(contextVar, null); - } + WorkflowSignalSender.eventHappened(WorkflowSignalSender.EVENT_UPDATE(), pTargetId, pTargetContext); } /** @@ -247,21 +207,25 @@ WorkflowSignalSender.deleted = function (pTargetId, pTargetContext) */ WorkflowSignalSender.eventHappened = function (pEvent, pTargetId, pTargetContext) { - if (!pTargetId) - pTargetId = vars.get("$sys.uid"); - if (!pTargetContext) - pTargetContext = ContextUtils.getCurrentContextId(); + var variables = WorkflowVariables.getTargetVariables(pTargetId, pTargetContext); - var signals = WorkflowSignalSender.getSignalConfig(pTargetContext, pEvent); + var signals = WorkflowSignalSender.getSignalConfig(variables[WorkflowVariables.TARGET_CONTEXT()], pEvent); signals.forEach(function (signal) { - if (_checkCondition(signal.entity, pTargetId, signal.condition)) - workflow.signalEventReceived(signal.name); //TODO: targetId and targetContext variables + if (_checkCondition(signal.entity, variables[WorkflowVariables.TARGET_ID()], signal.condition)) + { + var filteredVariables = {}; + signal.variables.forEach(function (varName) + { + filteredVariables[varName] = variables[varName]; + }); + workflow.signalEventReceived(signal.name, filteredVariables); + } }); function _checkCondition (pEntity, pUid, pCondition) { - if (!pCondition) + if (!pCondition || (pCondition.type === "group" && pCondition.childs.length === 0)) return true; var loadConfig = entities.createConfigForLoadingRows() @@ -280,7 +244,7 @@ WorkflowSignalSender.eventHappened = function (pEvent, pTargetId, pTargetContext * @param {String} [pEvent] event that is defined for the signals * @return {Object[]} Array of objects, with these properties:<br/> * <ul> - * <li>name: name of the signal</li> + * <li>name: name (id) of the signal</li> * <li>event: event that triggers the signal</li> * <li>entity: entity where the event should happen</li> * <li>condition: a condition that is checked before the signal is sent, null if there's no condition</li> @@ -288,7 +252,7 @@ WorkflowSignalSender.eventHappened = function (pEvent, pTargetId, pTargetContext */ WorkflowSignalSender.getSignalConfig = function (pContext, pEvent) { - var signals = newSelect("SIGNAL_NAME, TRIGGER_EVENT, OBJECT_CONDITION, OBJECT_TYPE") + var signals = newSelect("SIGNAL_NAME, TRIGGER_EVENT, OBJECT_CONDITION, OBJECT_TYPE, VARIABLES") .from("WORKFLOWSIGNAL") .whereIfSet("WORKFLOWSIGNAL.OBJECT_TYPE", pContext) .andIfSet("WORKFLOWSIGNAL.TRIGGER_EVENT", pEvent) @@ -304,7 +268,8 @@ WorkflowSignalSender.getSignalConfig = function (pContext, pEvent) name : signal[0], event : signal[1], entity : ContextUtils.getEntity(signal[3]), - condition : condition + condition : condition, + variables : signal[4] ? text.decodeMS(signal[4]) : [] }; }); } @@ -313,12 +278,12 @@ WorkflowSignalSender.getSignalConfig = function (pContext, pEvent) * Provides functions for common workflow variables. This includes "default" variables that should normally be set for workflows or variables * that are used very often in different workflows. */ -function WorkflowCommonVariables () {} +function WorkflowVariables () {} /** * Returns the variable name for the target id */ -WorkflowCommonVariables.TARGET_ID = function () +WorkflowVariables.TARGET_ID = function () { return "targetId"; } @@ -326,7 +291,7 @@ WorkflowCommonVariables.TARGET_ID = function () /** * Returns the default value for the target id */ -WorkflowCommonVariables.TARGET_ID.getDefaultValue = function () +WorkflowVariables.TARGET_ID.getDefaultValue = function () { return vars.get("$sys.uid"); } @@ -334,7 +299,7 @@ WorkflowCommonVariables.TARGET_ID.getDefaultValue = function () /** * Returns the variable name for the target context */ -WorkflowCommonVariables.TARGET_CONTEXT = function () +WorkflowVariables.TARGET_CONTEXT = function () { return "targetContext"; } @@ -342,7 +307,7 @@ WorkflowCommonVariables.TARGET_CONTEXT = function () /** * Returns the default value for the target id */ -WorkflowCommonVariables.TARGET_CONTEXT.getDefaultValue = function () +WorkflowVariables.TARGET_CONTEXT.getDefaultValue = function () { return ContextUtils.getCurrentContextId(); } @@ -354,14 +319,14 @@ WorkflowCommonVariables.TARGET_CONTEXT.getDefaultValue = function () * @param {String} [pTargetContext] value for the target context, if not provided, the current context is used * @return {Object} object containing the variables */ -WorkflowCommonVariables.getTargetVariables = function (pTargetId, pTargetContext) +WorkflowVariables.getTargetVariables = function (pTargetId, pTargetContext) { var variables = {}; - variables[WorkflowCommonVariables.TARGET_ID()] = pTargetId == undefined - ? WorkflowCommonVariables.TARGET_ID.getDefaultValue() + variables[WorkflowVariables.TARGET_ID()] = pTargetId == undefined + ? WorkflowVariables.TARGET_ID.getDefaultValue() : pTargetId; - variables[WorkflowCommonVariables.TARGET_CONTEXT()] = pTargetContext == undefined - ? WorkflowCommonVariables.TARGET_CONTEXT.getDefaultValue() + variables[WorkflowVariables.TARGET_CONTEXT()] = pTargetContext == undefined + ? WorkflowVariables.TARGET_CONTEXT.getDefaultValue() : pTargetContext; return variables; -- GitLab