Skip to content
Snippets Groups Projects
Commit 4f0bfc5c authored by Sebastian Listl's avatar Sebastian Listl :speech_balloon: Committed by Martin Groppe
Browse files

1079736 workflow links

parent d185c859
No related branches found
No related tags found
No related merge requests found
Showing
with 227 additions and 40 deletions
<?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="90e1ef8c-62ac-4c98-839b-429b8ae83251">
<addColumn tableName="WEBLINK">
<column name="ACTION_TYPE" type="VARCHAR(36)"/>
<column name="WORKFLOWSIGNAL_NAME" type="VARCHAR(255)"/>
</addColumn>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
<?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">
<include relativeToChangelogFile="true" file="add_weblinkWorkflowColumns.xml"/>
<include relativeToChangelogFile="true" file="insert_linkActionTypeKeyword.xml"/>
</databaseChangeLog>
\ No newline at end of file
<?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="3b41b283-4e04-451f-96c9-ab829b2ab06c">
<insert tableName="AB_KEYWORD_CATEGORY">
<column name="AB_KEYWORD_CATEGORYID" value="90afa287-20b7-4d52-9227-63950f2c96be"/>
<column name="NAME" value="WeblinkActionType"/>
<column name="SORTINGBY" valueNumeric="0"/>
<column name="SORTINGDIRECTION" value="ASC"/>
</insert>
<insert tableName="AB_KEYWORD_ENTRY">
<column name="AB_KEYWORD_ENTRYID" value="afd1b624-c7c3-47c9-9ec3-c4638652ca1f"/>
<column name="AB_KEYWORD_CATEGORY_ID" value="90afa287-20b7-4d52-9227-63950f2c96be"/>
<column name="KEYID" value="LINKACTION_STARTWORKFLOW"/>
<column name="TITLE" value="Start workflow"/>
<column name="CONTAINER" value="WeblinkActionType"/>
<column name="SORTING" valueNumeric="1"/>
<column name="ISACTIVE" valueNumeric="1"/>
<column name="ISESSENTIAL" valueNumeric="0"/>
</insert>
<insert tableName="AB_KEYWORD_ENTRY">
<column name="AB_KEYWORD_ENTRYID" value="2cd0b9e4-7a37-4d44-96e8-13d77e08213c"/>
<column name="AB_KEYWORD_CATEGORY_ID" value="90afa287-20b7-4d52-9227-63950f2c96be"/>
<column name="KEYID" value="LINKACTION_SENDSIGNAL"/>
<column name="TITLE" value="Send workflow signal"/>
<column name="CONTAINER" value="WeblinkActionType"/>
<column name="SORTING" valueNumeric="2"/>
<column name="ISACTIVE" valueNumeric="1"/>
<column name="ISESSENTIAL" valueNumeric="0"/>
</insert>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -13,4 +13,5 @@
<include relativeToChangelogFile="true" file="DSGVO/changelog.xml"/>
<include relativeToChangelogFile="true" file="update_ab_countryinfo_name_native.xml"/>
<include relativeToChangelogFile="true" file="create_probability_keywords.xml"/>
<include relativeToChangelogFile="true" file="LinkWorkflows/changelog.xml"/>
</databaseChangeLog>
\ No newline at end of file
......@@ -18591,8 +18591,8 @@
<dbName></dbName>
<primaryKey v="false" />
<columnType v="93" />
<size v="29" />
<scale v="9" />
<size v="19" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
......@@ -18619,8 +18619,8 @@
<dbName></dbName>
<primaryKey v="false" />
<columnType v="93" />
<size v="29" />
<scale v="9" />
<size v="19" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
......@@ -18716,8 +18716,36 @@
<name>ISREDIRECT</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="5" />
<size v="5" />
<columnType v="-6" />
<size v="3" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>WORKFLOWSIGNAL_NAME</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="12" />
<size v="255" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>ACTION_TYPE</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="12" />
<size v="36" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
......@@ -18962,20 +18990,6 @@
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>FILEPATH</name>
<dbName></dbName>
<primaryKey v="false" />
<columnType v="12" />
<size v="255" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<documentation></documentation>
<title></title>
<description></description>
</entityFieldDb>
<entityFieldDb>
<name>MAIL_RUN_ID</name>
<dbName></dbName>
......@@ -18985,7 +18999,7 @@
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<index v="true" />
<documentation></documentation>
<title></title>
<description></description>
......@@ -18995,7 +19009,7 @@
<dbName></dbName>
<primaryKey v="false" />
<columnType v="93" />
<size v="23" />
<size v="19" />
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
......@@ -19013,7 +19027,7 @@
<scale v="0" />
<notNull v="false" />
<isUnique v="false" />
<index v="false" />
<index v="true" />
<documentation></documentation>
<title></title>
<description></description>
......
......@@ -750,6 +750,12 @@
<fieldName>KeywordProbabilityOffer</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>48d817dc-e0fd-4d4b-bb48-3567a570105d</name>
<entityName>Weblink_entity</entityName>
<fieldName>KeywordActionTypes</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
<children>
<entityParameter>
......
......@@ -133,6 +133,31 @@
<stateProcess>%aditoprj%/entity/Weblink_entity/entityfields/isredirect/stateProcess.js</stateProcess>
<valueProcess>%aditoprj%/entity/Weblink_entity/entityfields/isredirect/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>ACTION_TYPE</name>
<title>Action</title>
<consumer>KeywordActionTypes</consumer>
<stateProcess>%aditoprj%/entity/Weblink_entity/entityfields/action_type/stateProcess.js</stateProcess>
</entityField>
<entityConsumer>
<name>KeywordActionTypes</name>
<dependency>
<name>dependency</name>
<entityName>KeywordEntry_entity</entityName>
<fieldName>SpecificContainerKeywords</fieldName>
</dependency>
<children>
<entityParameter>
<name>ContainerName_param</name>
<valueProcess>%aditoprj%/entity/Weblink_entity/entityfields/keywordactiontypes/children/containername_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityField>
<name>WORKFLOWSIGNAL_NAME</name>
<title>Signal</title>
<stateProcess>%aditoprj%/entity/Weblink_entity/entityfields/workflowsignal_name/stateProcess.js</stateProcess>
</entityField>
</entityFields>
<recordContainers>
<dbRecordContainer>
......@@ -195,6 +220,14 @@
<name>ISREDIRECT.value</name>
<recordfield>WEBLINK.ISREDIRECT</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>ACTION_TYPE.value</name>
<recordfield>WEBLINK.ACTION_TYPE</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>WORKFLOWSIGNAL_NAME.value</name>
<recordfield>WEBLINK.WORKFLOWSIGNAL_NAME</recordfield>
</dbRecordFieldMapping>
</recordFieldMappings>
<linkInformation>
<linkInformation>
......
import("Util_lib");
import("system.result");
import("system.vars");
import("KeywordRegistry_basic");
import("system.neon");
var linktype = vars.get("$field.LINKTYPE");
var isRedirect = Utils.toBoolean(vars.get("$field.ISREDIRECT"));
if (linktype == $KeywordRegistry.weblinkType$EMail() && isRedirect)
{
result.string(neon.COMPONENTSTATE_EDITABLE);
}
else
{
result.string(neon.COMPONENTSTATE_INVISIBLE);
}
\ No newline at end of file
import("KeywordRegistry_basic");
import("system.result");
result.string($KeywordRegistry.weblinkActionType());
\ No newline at end of file
import("Util_lib");
import("system.result");
import("system.vars");
import("KeywordRegistry_basic");
import("system.neon");
var linktype = vars.get("$field.LINKTYPE");
var redirect = vars.get("$field.ISREDIRECT");
var isRedirect = Utils.toBoolean(vars.get("$field.ISREDIRECT"));
var actionType = vars.get("$field.ACTION_TYPE");
if (linktype == $KeywordRegistry.weblinkType$EMail() && redirect == "1")
if (linktype == $KeywordRegistry.weblinkType$EMail() && isRedirect && actionType == $KeywordRegistry.weblinkActionType$startWorkflow())
{
result.string(neon.COMPONENTSTATE_EDITABLE);
}
else
{
result.string(neon.COMPONENTSTATE_INVISIBLE);
}
\ No newline at end of file
import("Util_lib");
import("system.result");
import("system.vars");
import("KeywordRegistry_basic");
import("system.neon");
var linktype = vars.get("$field.LINKTYPE");
var isRedirect = Utils.toBoolean(vars.get("$field.ISREDIRECT"));
var actionType = vars.get("$field.ACTION_TYPE");
if (linktype == $KeywordRegistry.weblinkType$EMail() && isRedirect && actionType == $KeywordRegistry.weblinkActionType$sendWorkflowSignal())
{
result.string(neon.COMPONENTSTATE_EDITABLE);
}
else
{
result.string(neon.COMPONENTSTATE_INVISIBLE);
}
\ No newline at end of file
......@@ -35,10 +35,18 @@
<name>2b22fb4a-5e7e-48ee-b6d1-3ee4381fb419</name>
<entityField>ISREDIRECT</entityField>
</entityFieldLink>
<entityFieldLink>
<name>65495a4d-dccf-42ba-bba4-af15b9ad06aa</name>
<entityField>ACTION_TYPE</entityField>
</entityFieldLink>
<entityFieldLink>
<name>90ab2682-bc2d-4989-ab7b-b47045a3cbf3</name>
<entityField>WORKFLOWPROCESSDEFINITION_KEY</entityField>
</entityFieldLink>
<entityFieldLink>
<name>8a33e22d-c607-4a56-8384-668cc225225d</name>
<entityField>WORKFLOWSIGNAL_NAME</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
<neonViewReference>
......
......@@ -117,12 +117,35 @@ BulkMailUtils.sendBulkMail = function (pBulkMailId, pIsTestRun)
"TESTRUN": pIsTestRun ? 1 : 0
});
var mailLogIds = new Map();
var contactIds = recipientData.map(function (recipient)
{
var contactId = recipient["CONTACT_ID"];
mailLogIds.set(contactId, util.getNewUUID());
return contactId;
});
var baseUrl = vars.get("$sys.origin") + "/services/rest/redirect_rest?";
var linkPlaceholders = newSelect(["PLACEHOLDER", "WEBLINKID", "URL", "ISREDIRECT"])
.from("WEBLINK")
.table()
.map(function ([placeholder, weblinkId, url, isRedirect])
{
if (Utils.toBoolean(isRedirect))
{
var linkFn = function (pContactId)
{
return baseUrl + "link=" + weblinkId + "&log=" + mailLogIds.get(pContactId);
}
return new Placeholder(placeholder, Placeholder.types.CALLBACKFUNCTION, linkFn);
}
return new Placeholder(placeholder, Placeholder.types.FIXEDVALUE, url);
});
var contactIds = recipientData.map(function (recipient) {return recipient["CONTACT_ID"];});
var successIds = [];
var failedIds = [];
var sentDate = vars.get("$sys.date");
var mails = template.getReplacedEmailsByContactIds(contactIds);
var mails = template.getReplacedEmailsByContactIds(contactIds, linkPlaceholders);
var subjectTemplate = new DocumentTemplate(subject, DocumentTemplate.types.PLAIN);
var subjects = subjectTemplate.getReplacedContentByContactIds(contactIds);
......@@ -140,7 +163,7 @@ BulkMailUtils.sendBulkMail = function (pBulkMailId, pIsTestRun)
let personId = recipient["PERSON_ID"];
let organisationId = recipient["ORGANISATION_ID"];
let email = mails[contactId];
let mailLogId = util.getNewUUID();
let mailLogId = mailLogIds.get(contactId);
if (email !== undefined && emailAddress)
{
email.toRecipients = [emailAddress];
......@@ -577,7 +600,7 @@ BulkMailUtils.getRedirectLink = function(pLinkId)
* The device type that was used to open the link.<br>
**/
BulkMailUtils.insertClick = function(pMailLogId,pIpAddress,pLinkId,pBrowsername,pOperatingSystemName,pDeviceType)
BulkMailUtils.insertClick = function (pMailLogId,pIpAddress,pLinkId,pBrowsername,pOperatingSystemName,pDeviceType)
{
if (!pMailLogId || !pLinkId)
{
......@@ -618,15 +641,23 @@ BulkMailUtils.startBulkmailWorkFlow = function(pMailLogId, pLinkId)
{
return
}
var workFlowKey = newSelect("WORKFLOWPROCESSDEFINITION_KEY").from("WEBLINK").where("WEBLINK.WEBLINKID", pLinkId).cell();
if (workFlowKey)
var [actionType, workflowKey, signalName] = newSelect(["ACTION_TYPE", "WORKFLOWPROCESSDEFINITION_KEY", "WORKFLOWSIGNAL_NAME"])
.from("WEBLINK")
.where("WEBLINK.WEBLINKID", pLinkId)
.arrayRow();
var variables = {
"mailLogId": pMailLogId,
"linkId": pLinkId
};
if (actionType == $KeywordRegistry.weblinkActionType$startWorkflow() && workflowKey)
{
var variables = {
"MAILLOGID": pMailLogId
};
workflow.startProcessByKey(workFlowKey, variables);
workflow.startProcessByKey(workflowKey, variables);
}
else if (actionType == $KeywordRegistry.weblinkActionType$sendWorkflowSignal() && signalName)
{
workflow.signalEventReceived(signalName, variables);
}
}
......
......@@ -555,7 +555,7 @@ DocumentTemplate.prototype.getReplacedEmailsByContactIds = function (pContactIds
var emailObjects = {};
var isEML = this.type == DocumentTemplate.types.EML;
this.setOptions({base64 : isEML});
var emailContents = this.getReplacedContentByContactIds(pContactIds, PlaceholderUtils.getLinkPlaceholders());
var emailContents = this.getReplacedContentByContactIds(pContactIds, pAdditionalPlaceholders);
for (let contactId in emailContents)
{
......
......@@ -404,4 +404,8 @@ $KeywordRegistry.deviceType = function(){return "DeviceType";};
$KeywordRegistry.interestLinkStatus$notSubscribed = function(){return "INTERESTLINK_NOTSUBSCRIBED";};
$KeywordRegistry.communicationBlacklistType = function(){return "CommunicationBlacklistType";};
$KeywordRegistry.communicationBlacklistType$emailRecipientFilter = function(){return "BLACKLIST_TYPE_EMAILRECIPIENT_FILTER";};
\ No newline at end of file
$KeywordRegistry.communicationBlacklistType$emailRecipientFilter = function(){return "BLACKLIST_TYPE_EMAILRECIPIENT_FILTER";};
$KeywordRegistry.weblinkActionType = function(){return "WeblinkActionType";};
$KeywordRegistry.weblinkActionType$startWorkflow = function(){return "LINKACTION_STARTWORKFLOW";};
$KeywordRegistry.weblinkActionType$sendWorkflowSignal = function(){return "LINKACTION_SENDSIGNAL";};
\ 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