Skip to content
Snippets Groups Projects
Commit e1b4ede3 authored by Martin Groppe's avatar Martin Groppe Committed by Sebastian Listl
Browse files

[Projekt: xRM-Marketing][TicketNr.: 1083939][Fehler in Interessensgebieten:...

[Projekt: xRM-Marketing][TicketNr.: 1083939][Fehler in Interessensgebieten: Default wird nicht ausgewertet]
parent c71e54e9
No related branches found
No related tags found
No related merge requests found
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -15,7 +15,18 @@
</serviceTask>
<endEvent id="sid-A28ACC77-98D5-418A-B2DA-70EED93C00AD"></endEvent>
<sequenceFlow id="sid-D6DD7380-3B51-4F31-B5BC-41EFAD3B02E4" sourceRef="startEvent1" targetRef="sid-81F27FC6-FB34-404B-8AA8-84384A1CFAED"></sequenceFlow>
<sequenceFlow id="sid-5EC260F6-7456-4576-92C5-5C536D14E339" sourceRef="sid-81F27FC6-FB34-404B-8AA8-84384A1CFAED" targetRef="sid-A28ACC77-98D5-418A-B2DA-70EED93C00AD"></sequenceFlow>
<serviceTask id="sid-FF1C6322-7046-44BC-A2AF-3A122A7CCE1B" name="Set Default Interests" flowable:class="de.adito.aditoweb.server.neon.workflow.WorkflowServiceTask">
<extensionElements>
<flowable:field name="jditoProcess">
<flowable:string><![CDATA[SetInterestLink_workflowService]]></flowable:string>
</flowable:field>
<flowable:field name="taskVariables">
<flowable:string><![CDATA[{"status":{"value":"INTERESTLINK_SUBSCRIBED"},"interestId":{"value":""},"setDefaultInterests":{"value":true}}]]></flowable:string>
</flowable:field>
</extensionElements>
</serviceTask>
<sequenceFlow id="sid-101F9FEB-D73B-47F6-B378-C5A3122F4A1F" sourceRef="sid-81F27FC6-FB34-404B-8AA8-84384A1CFAED" targetRef="sid-FF1C6322-7046-44BC-A2AF-3A122A7CCE1B"></sequenceFlow>
<sequenceFlow id="sid-52D8F089-0ED2-4ADB-9A76-A6996E0AC72B" sourceRef="sid-FF1C6322-7046-44BC-A2AF-3A122A7CCE1B" targetRef="sid-A28ACC77-98D5-418A-B2DA-70EED93C00AD"></sequenceFlow>
</process>
<bpmndi:BPMNDiagram id="BPMNDiagram_allowEmailCommunication">
<bpmndi:BPMNPlane bpmnElement="allowEmailCommunication" id="BPMNPlane_allowEmailCommunication">
......@@ -26,15 +37,22 @@
<omgdc:Bounds height="80.0" width="100.0" x="210.0" y="136.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-A28ACC77-98D5-418A-B2DA-70EED93C00AD" id="BPMNShape_sid-A28ACC77-98D5-418A-B2DA-70EED93C00AD">
<omgdc:Bounds height="28.0" width="28.0" x="375.0" y="164.0"></omgdc:Bounds>
<omgdc:Bounds height="28.0" width="28.0" x="510.0" y="162.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="sid-FF1C6322-7046-44BC-A2AF-3A122A7CCE1B" id="BPMNShape_sid-FF1C6322-7046-44BC-A2AF-3A122A7CCE1B">
<omgdc:Bounds height="80.0" width="100.0" x="345.0" y="136.0"></omgdc:Bounds>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="sid-D6DD7380-3B51-4F31-B5BC-41EFAD3B02E4" id="BPMNEdge_sid-D6DD7380-3B51-4F31-B5BC-41EFAD3B02E4">
<omgdi:waypoint x="129.94860715897664" y="177.7931227241285"></omgdi:waypoint>
<omgdi:waypoint x="209.9999999999986" y="176.6889655172414"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-5EC260F6-7456-4576-92C5-5C536D14E339" id="BPMNEdge_sid-5EC260F6-7456-4576-92C5-5C536D14E339">
<omgdi:waypoint x="309.95000000000005" y="176.77441860465117"></omgdi:waypoint>
<omgdi:waypoint x="375.00104904016473" y="177.78297128864668"></omgdi:waypoint>
<bpmndi:BPMNEdge bpmnElement="sid-52D8F089-0ED2-4ADB-9A76-A6996E0AC72B" id="BPMNEdge_sid-52D8F089-0ED2-4ADB-9A76-A6996E0AC72B">
<omgdi:waypoint x="444.95000000000005" y="176.0"></omgdi:waypoint>
<omgdi:waypoint x="510.0" y="176.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="sid-101F9FEB-D73B-47F6-B378-C5A3122F4A1F" id="BPMNEdge_sid-101F9FEB-D73B-47F6-B378-C5A3122F4A1F">
<omgdi:waypoint x="309.95000000000005" y="176.0"></omgdi:waypoint>
<omgdi:waypoint x="345.0" y="176.0"></omgdi:waypoint>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
......
......@@ -4,6 +4,7 @@
<majorModelMode>DISTRIBUTED</majorModelMode>
<process>%aditoprj%/process/SetInterestLink_workflowService/process.js</process>
<alias>Data_alias</alias>
<serviceTaskParameterProcess>%aditoprj%/process/SetInterestLink_workflowService/serviceTaskParameterProcess.js</serviceTaskParameterProcess>
<variants>
<element>WORKFLOW</element>
</variants>
......
......@@ -6,17 +6,34 @@ import("Sql_lib");
var variables = JSON.parse(vars.get("$local.value"));
var contactId = variables.contactId || variables.targetId;
var interestId = variables.interestId;
var setDefaultInterests = variables.setDefaultInterests || false;
if (!interestId && variables.mailLogId)
{
interestId = newSelect("MAIL_RUN.INTERESTID")
interestId = newSelect("MAIL_RUN.INTEREST_ID")
.from("MAIL_LOG")
.join("MAIL_RUN", "MAIL_LOG.MAIL_RUN_ID = MAIL_RUN.MAIL_RUNID")
.where("MAIL_LOG.MAIL_LOGID", variables.mailLogId)
.cell();
}
var status = variables.status || $KeywordRegistry.interestLinkStatus$notSubscribed();
var interestIds = [];
var interestLinkId = new SqlBuilder()
if(setDefaultInterests)
{
interestIds = newSelect("INTERESTID")
.from("INTEREST")
.where("INTEREST.IS_DEFAULT",1)
.and("INTEREST.STATUS",$KeywordRegistry.interestStatus$active())
.arrayColumn();
}
if (interestId && !interestIds.includes(interestId))
{
interestIds.push(interestId);
}
interestIds.forEach(function (interestId){
var interestLinkId = new SqlBuilder()
.select("INTERESTLINKID")
.from("INTERESTLINK")
.where("INTERESTLINK.CONTACT_ID", contactId)
......@@ -24,19 +41,20 @@ var interestLinkId = new SqlBuilder()
.and("INTERESTLINK.STATUS", status)
.cell();
if (interestLinkId)
{
newWhere("INTERESTLINK.INTERESTLINKID", interestLinkId)
.updateFields({"STATUS": status});
}
else
{
new SqlBuilder()
.tableName("INTERESTLINK")
.insertFields({
"INTERESTLINKID": util.getNewUUID(),
"INTEREST_ID": interestId,
"CONTACT_ID": contactId,
"STATUS": status
});
}
\ No newline at end of file
if (interestLinkId)
{
newWhere("INTERESTLINK.INTERESTLINKID", interestLinkId)
.updateFields({"STATUS": status});
}
else
{
new SqlBuilder()
.tableName("INTERESTLINK")
.insertFields({
"INTERESTLINKID": util.getNewUUID(),
"INTEREST_ID": interestId,
"CONTACT_ID": contactId,
"STATUS": status
});
}
});
import("Keyword_lib");
import("system.result");
import("system.vars");
import("Sql_lib");
import("Workflow_lib");
import("KeywordRegistry_basic");
var interests = newSelect(["INTERESTID", "TITLE"])
.from("INTEREST")
.where("INTEREST.STATUS",$KeywordRegistry.interestStatus$active())
.table()
.map(function ([id, name])
{
return {
id: id,
name: name
};
});
var parameters = [
new WorkflowServiceTaskParameter("status", "Subscription Status", WorkflowServiceTaskParameter.ENUM(), _getKeywords($KeywordRegistry.interestLinkStatus())),
new WorkflowServiceTaskParameter("interestId", "Interest", WorkflowServiceTaskParameter.ENUM(), interests),
new WorkflowServiceTaskParameter("setDefaultInterests","Set Default Interests",WorkflowServiceTaskParameter.BOOLEAN())
];
result.object(parameters);
function _getKeywords (pContainer)
{
return KeywordUtils.getEntryArray(pContainer).map(function (item) {return {id : item[0], name : item[1]};});
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment