From 60047a2b8e56274d6e663069ff37cdcb2d01a11c Mon Sep 17 00:00:00 2001 From: "S.Listl" <S.Listl@SLISTL.aditosoftware.local> Date: Fri, 21 Feb 2020 14:59:25 +0100 Subject: [PATCH] 1052195 - Changes for workflow signals --- .../afterOperatingState.js | 3 ++- .../recordcontainers/db/onDBDelete.js | 3 ++- .../recordcontainers/db/onDBInsert.js | 4 ++- .../recordcontainers/db/onDBUpdate.js | 3 ++- entity/Person_entity/afterOperatingState.js | 3 ++- .../recordcontainers/db/onDBDelete.js | 3 ++- .../recordcontainers/db/onDBInsert.js | 2 ++ .../recordcontainers/db/onDBUpdate.js | 3 ++- .../WorkflowSignal_entity.aod | 13 +++++++++- .../signal_name/dropDownProcess.js | 26 +++++++++---------- .../icon.value/expression.js | 0 .../WorkflowTask_entity.aod | 1 + .../entityfields/isactive/dropDownProcess.js | 7 +++++ .../_____LANGUAGE_EXTRA.aod | 3 +++ .../_____LANGUAGE_de/_____LANGUAGE_de.aod | 8 ++++++ .../_____LANGUAGE_en/_____LANGUAGE_en.aod | 4 +++ neonContext/WorkflowSignal/WorkflowSignal.aod | 1 + .../WorkflowSignalPreview_view.aod | 25 ++++++++++++++++++ process/Sql_lib/process.js | 7 ++--- process/Workflow_lib/process.js | 1 + 20 files changed, 94 insertions(+), 26 deletions(-) create mode 100644 entity/WorkflowSignal_entity/recordcontainers/db/recordfieldmappings/icon.value/expression.js create mode 100644 entity/WorkflowTask_entity/entityfields/isactive/dropDownProcess.js diff --git a/entity/Organisation_entity/afterOperatingState.js b/entity/Organisation_entity/afterOperatingState.js index 95c27335097..1dea5d13d3b 100644 --- a/entity/Organisation_entity/afterOperatingState.js +++ b/entity/Organisation_entity/afterOperatingState.js @@ -5,4 +5,5 @@ 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 +} +WorkflowSignalSender.doInsertedOrUpdated(); diff --git a/entity/Organisation_entity/recordcontainers/db/onDBDelete.js b/entity/Organisation_entity/recordcontainers/db/onDBDelete.js index a964f1770ac..f17ef01bdde 100644 --- a/entity/Organisation_entity/recordcontainers/db/onDBDelete.js +++ b/entity/Organisation_entity/recordcontainers/db/onDBDelete.js @@ -5,4 +5,5 @@ import("DuplicateScanner_lib"); let contactId = vars.get("$field.CONTACTID"); DuplicateScannerUtils.DeleteCachedDuplicate(contactId); -WorkflowStarter.deleted(); \ No newline at end of file +WorkflowStarter.deleted(); +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 658ba4e14cb..f4265e2aa52 100644 --- a/entity/Organisation_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Organisation_entity/recordcontainers/db/onDBInsert.js @@ -1,4 +1,6 @@ +import("Workflow_lib"); 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 +vars.set("$context.workflowQueue", {}); +WorkflowSignalSender.markInserted(); \ 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 5738b35a68a..166750a8ae1 100644 --- a/entity/Organisation_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Organisation_entity/recordcontainers/db/onDBUpdate.js @@ -15,4 +15,5 @@ FieldChanges.assimilateChangeAndDispose("$field.STANDARD_PHONE_COMMUNICATION", f CommUtil.setStandardPhone(uid, value); }); -WorkflowStarter.updated(); \ No newline at end of file +WorkflowStarter.updated(); +WorkflowSignalSender.markUpdated(); \ No newline at end of file diff --git a/entity/Person_entity/afterOperatingState.js b/entity/Person_entity/afterOperatingState.js index 95c27335097..e793ce58bd2 100644 --- a/entity/Person_entity/afterOperatingState.js +++ b/entity/Person_entity/afterOperatingState.js @@ -5,4 +5,5 @@ 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 +} +WorkflowSignalSender.doInsertedOrUpdated(); \ 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 a964f1770ac..f17ef01bdde 100644 --- a/entity/Person_entity/recordcontainers/db/onDBDelete.js +++ b/entity/Person_entity/recordcontainers/db/onDBDelete.js @@ -5,4 +5,5 @@ import("DuplicateScanner_lib"); let contactId = vars.get("$field.CONTACTID"); DuplicateScannerUtils.DeleteCachedDuplicate(contactId); -WorkflowStarter.deleted(); \ No newline at end of file +WorkflowStarter.deleted(); +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 39b660ad344..c9a099d7e32 100644 --- a/entity/Person_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Person_entity/recordcontainers/db/onDBInsert.js @@ -1,3 +1,4 @@ +import("Workflow_lib"); import("system.util"); import("Sql_lib"); import("system.db"); @@ -10,6 +11,7 @@ DataPrivacyUtils.notifyNeedDataPrivacyUpdate(contactId); //start the execution in afterOperatingState, because here the dataset is not yet inserted vars.set("$context.workflowQueue", {}); +WorkflowSignalSender.markInserted(); //let valuesToCheck = {}; // diff --git a/entity/Person_entity/recordcontainers/db/onDBUpdate.js b/entity/Person_entity/recordcontainers/db/onDBUpdate.js index 0e8c2769a28..b62e00ce63a 100644 --- a/entity/Person_entity/recordcontainers/db/onDBUpdate.js +++ b/entity/Person_entity/recordcontainers/db/onDBUpdate.js @@ -43,4 +43,5 @@ vars.get("$local.changed").forEach(function(fieldName) DataPrivacyUtils.notifyNeedDataPrivacyUpdate(uid); -WorkflowStarter.updated(); \ No newline at end of file +WorkflowStarter.updated(); +WorkflowSignalSender.markUpdated(); \ No newline at end of file diff --git a/entity/WorkflowSignal_entity/WorkflowSignal_entity.aod b/entity/WorkflowSignal_entity/WorkflowSignal_entity.aod index 29415919152..ba7132b6430 100644 --- a/entity/WorkflowSignal_entity/WorkflowSignal_entity.aod +++ b/entity/WorkflowSignal_entity/WorkflowSignal_entity.aod @@ -15,6 +15,7 @@ <entityField> <name>SIGNAL_NAME</name> <title>Signal</title> + <mandatory v="true" /> <dropDownProcess>%aditoprj%/entity/WorkflowSignal_entity/entityfields/signal_name/dropDownProcess.js</dropDownProcess> </entityField> <entityField> @@ -35,10 +36,11 @@ <name>TRIGGER_EVENT</name> <title>Trigger</title> <consumer>TriggerKeyword</consumer> + <mandatory v="true" /> </entityField> <entityField> <name>OBJECT_CONDITION</name> - <title>Condition</title> + <title>${CONDITION}</title> <contentType>FILTER_TREE</contentType> <valueProcess>%aditoprj%/entity/WorkflowSignal_entity/entityfields/object_condition/valueProcess.js</valueProcess> </entityField> @@ -84,6 +86,10 @@ <expose v="true" /> <mandatory v="true" /> </entityParameter> + <entityField> + <name>ICON</name> + <contentType>IMAGE</contentType> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> @@ -120,6 +126,7 @@ <dbRecordFieldMapping> <name>TRIGGER_EVENT.value</name> <recordfield>WORKFLOWSIGNAL.TRIGGER_EVENT</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>TRIGGER_EVENT.displayValue</name> @@ -129,6 +136,10 @@ <name>PROCESSDEFINITION_KEY.value</name> <recordfield>WORKFLOWSIGNAL.PROCESSDEFINITION_KEY</recordfield> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ICON.value</name> + <expression>%aditoprj%/entity/WorkflowSignal_entity/recordcontainers/db/recordfieldmappings/icon.value/expression.js</expression> + </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> </recordContainers> diff --git a/entity/WorkflowSignal_entity/entityfields/signal_name/dropDownProcess.js b/entity/WorkflowSignal_entity/entityfields/signal_name/dropDownProcess.js index f61a89cec96..50e53ca72a8 100644 --- a/entity/WorkflowSignal_entity/entityfields/signal_name/dropDownProcess.js +++ b/entity/WorkflowSignal_entity/entityfields/signal_name/dropDownProcess.js @@ -1,13 +1,13 @@ -//import("system.result"); -//import("system.workflow"); -//import("system.vars"); -// -//var processDefinitionId = vars.get("$param.ProcessDefinitionId_param"); -//var signals = processDefinitionId -// ? JSON.parse(workflow.getSignalDefinitions(processDefinitionId)) -// : []; -// -//result.object(signals.map(function (signal) -//{ -// return [signal.name, signal.name]; -//})); \ No newline at end of file +import("system.result"); +import("system.workflow"); +import("system.vars"); + +var processDefinitionId = vars.get("$param.ProcessDefinitionId_param"); +var signals = processDefinitionId + ? JSON.parse(workflow.getSignalDefinitions(processDefinitionId)) + : []; + +result.object(signals.map(function (signal) +{ + return [signal.name, signal.name]; +})); \ No newline at end of file diff --git a/entity/WorkflowSignal_entity/recordcontainers/db/recordfieldmappings/icon.value/expression.js b/entity/WorkflowSignal_entity/recordcontainers/db/recordfieldmappings/icon.value/expression.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/entity/WorkflowTask_entity/WorkflowTask_entity.aod b/entity/WorkflowTask_entity/WorkflowTask_entity.aod index f7a1b1a9539..326f57420cf 100644 --- a/entity/WorkflowTask_entity/WorkflowTask_entity.aod +++ b/entity/WorkflowTask_entity/WorkflowTask_entity.aod @@ -120,6 +120,7 @@ <name>ISACTIVE</name> <title>Active</title> <contentType>BOOLEAN</contentType> + <dropDownProcess>%aditoprj%/entity/WorkflowTask_entity/entityfields/isactive/dropDownProcess.js</dropDownProcess> </entityField> <entityField> <name>CLAIM_TIME</name> diff --git a/entity/WorkflowTask_entity/entityfields/isactive/dropDownProcess.js b/entity/WorkflowTask_entity/entityfields/isactive/dropDownProcess.js new file mode 100644 index 00000000000..a5eec56c41a --- /dev/null +++ b/entity/WorkflowTask_entity/entityfields/isactive/dropDownProcess.js @@ -0,0 +1,7 @@ +import("system.translate"); +import("system.result"); + +result.object([ + ["true", translate.text("Yes")], + ["false", translate.text("No")] +]); \ No newline at end of file diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index d6cfab21d34..00d7b607eb6 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -6074,6 +6074,9 @@ <entry> <key>{SEARCH_INDEX_TITLE}</key> </entry> + <entry> + <key>${CONDITION}</key> + </entry> <entry> <key>${CANCELLED}</key> </entry> diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index 8dcdc61707f..5fab92102f8 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -10,6 +10,10 @@ <key>{SEARCH_INDEX_TITLE}</key> <value>Suche</value> </entry> + <entry> + <key>Signals</key> + <value>Signale</value> + </entry> <entry> <key>Data imported. Contact not found.</key> <value>Daten importiert. Keine weiteren Personendaten gefunden.</value> @@ -101,6 +105,10 @@ <key>No letters</key> <value>Keine Briefe</value> </entry> + <entry> + <key>${CONDITION}</key> + <value>Bedingung</value> + </entry> <entry> <key>Failed</key> <value>Fehlgeschlagen</value> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index 90ce4c7dde7..982fb10ef62 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -6133,6 +6133,10 @@ <key>{SEARCH_INDEX_TITLE}</key> <value>Search</value> </entry> + <entry> + <key>${CONDITION}</key> + <value>Condition</value> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/neonContext/WorkflowSignal/WorkflowSignal.aod b/neonContext/WorkflowSignal/WorkflowSignal.aod index af6b238d6fe..23a00e62cef 100644 --- a/neonContext/WorkflowSignal/WorkflowSignal.aod +++ b/neonContext/WorkflowSignal/WorkflowSignal.aod @@ -5,6 +5,7 @@ <majorModelMode>DISTRIBUTED</majorModelMode> <filterView>WorkflowSignalFilter_view</filterView> <editView>WorkflowSignalEdit_view</editView> + <previewView>WorkflowSignalPreview_view</previewView> <entity>WorkflowSignal_entity</entity> <references> <neonViewReference> diff --git a/neonView/WorkflowSignalPreview_view/WorkflowSignalPreview_view.aod b/neonView/WorkflowSignalPreview_view/WorkflowSignalPreview_view.aod index 2b648167cc5..141af77b7e7 100644 --- a/neonView/WorkflowSignalPreview_view/WorkflowSignalPreview_view.aod +++ b/neonView/WorkflowSignalPreview_view/WorkflowSignalPreview_view.aod @@ -7,4 +7,29 @@ <name>layout</name> </headerFooterLayout> </layout> + <children> + <cardViewTemplate> + <name>Card</name> + <titleField>SIGNAL_NAME</titleField> + <entityField>#ENTITY</entityField> + </cardViewTemplate> + <genericViewTemplate> + <name>Generic</name> + <entityField>#ENTITY</entityField> + <fields> + <entityFieldLink> + <name>6647006f-e790-4317-9374-d1a560464a12</name> + <entityField>TRIGGER_EVENT</entityField> + </entityFieldLink> + <entityFieldLink> + <name>bc231729-e6d0-457e-8eae-f8c972d8a79a</name> + <entityField>OBJECT_TYPE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>134903ad-9033-4057-9693-ab0fd5b3b6c4</name> + <entityField>OBJECT_CONDITION</entityField> + </entityFieldLink> + </fields> + </genericViewTemplate> + </children> </neonView> diff --git a/process/Sql_lib/process.js b/process/Sql_lib/process.js index b07b9e75034..09ddf0d0c55 100644 --- a/process/Sql_lib/process.js +++ b/process/Sql_lib/process.js @@ -1055,17 +1055,14 @@ SqlBuilder.prototype.join = function(pTable, pCondition, pTableAlias, pPrefix, p if (pPrefix) prefix = pPrefix + " " + prefix; - var postfix = "on"; + var postfix = pCondition ? "on" : ""; if (pTableAlias) postfix = pTableAlias + " " + postfix; else if (pTable instanceof SqlBuilder && pTable._subselectAlias) postfix = pTable._subselectAlias + " " + postfix; - if (!pCondition) - postfix = ""; - - var joinPart = SqlBuilder._getStatement(pTable, prefix, postfix); + var joinPart = SqlBuilder._getStatement(pTable, prefix, postfix.trim()); if (pCondition) { diff --git a/process/Workflow_lib/process.js b/process/Workflow_lib/process.js index c30ab64c7b2..56b195bb0c1 100644 --- a/process/Workflow_lib/process.js +++ b/process/Workflow_lib/process.js @@ -134,6 +134,7 @@ WorkflowStarter._startProcessByAction = function (pAction, pVariables, pTargetId }); } + function WorkflowSignalSender () {} WorkflowSignalSender.EVENT_INSERT = function () -- GitLab