Skip to content
Snippets Groups Projects
Commit 1b995534 authored by Sebastian Listl's avatar Sebastian Listl :speech_balloon:
Browse files

Merge branch 'm_1083587_lead_nurturing' into '2021.2.2'

M 1083587 lead nurturing

See merge request xrm/basic!1510
parents 21fea448 84541e24
No related branches found
No related tags found
No related merge requests found
Showing
with 252 additions and 11 deletions
......@@ -2,6 +2,7 @@
<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="Offer/changelog.xml"/>
<include relativeToChangelogFile="true" file="lead_nurturing/changelog.xml"/>
<include relativeToChangelogFile="true" file="add_offer_showprice.xml"/>
<include relativeToChangelogFile="true" file="Ticket/changelog.xml"/>
<include relativeToChangelogFile="true" file="StandardColumns/changelog.xml"/>
......
<?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="m.groppe" id="1801edd3-72d9-4297-8b9b-7ac14cb57884">
<addColumn tableName="BULKMAIL">
<column name="CAMPAIGN_ID" type="CHAR(36)"/>
</addColumn>
<createIndex indexName="IDX_BULKMAIL_CAMPAIGN_ID" tableName="BULKMAIL">
<column name="CAMPAIGN_ID" />
</createIndex>
</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="alter_bulkmail.xml"/>
<include relativeToChangelogFile="true" file="insert_adHocMailBulkMailStatus.xml"/>
<include relativeToChangelogFile="true" file="insert_documentTemplateTypeDownload.xml"/>
</databaseChangeLog>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<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="m.groppe" id="246a1182-ff3c-461a-b533-ae305f0468a6">
<insert tableName="AB_KEYWORD_ENTRY">
<column name="AB_KEYWORD_ENTRYID" value="b0fe2c5e-7195-497c-9a47-5837e0ce30a8"/>
<column name="KEYID" value="BULKMAILADHOC"/>
<column name="TITLE" value="Ad hoc"/>
<column name="CONTAINER" value="BulkMailStatus"/>
<column name="AB_KEYWORD_CATEGORY_ID" value="76fc02b9-a1b6-4c76-bdd5-a52d0e1ef286"/>
<column name="SORTING" valueNumeric="6"/>
<column name="ISACTIVE" valueNumeric="1"/>
<column name="ISESSENTIAL" valueNumeric="1"/>
</insert>
<insert tableName="AB_KEYWORD_ATTRIBUTERELATION">
<column name="AB_KEYWORD_ATTRIBUTERELATIONID" value="cfb85e46-8af0-432c-a783-251333c999bf"/>
<column name="AB_KEYWORD_ATTRIBUTE_ID" value="ec51253e-9b45-468d-aafa-42331e54f32b"/>
<column name="AB_KEYWORD_ENTRY_ID" value="b0fe2c5e-7195-497c-9a47-5837e0ce30a8"/>
<column name="CHAR_VALUE" value="VAADIN:ENVELOPE_OPEN"/>
</insert>
</changeSet>
</databaseChangeLog>
<?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="m.groppe" id="212e1f2b-9913-4555-b7d4-74b848c4712e">
<insert tableName="AB_KEYWORD_ENTRY">
<column name="AB_KEYWORD_ENTRYID" value="ec364de4-a2ef-47f0-a9ec-adec4496fbd0"/>
<column name="AB_KEYWORD_CATEGORY_ID" value="b5afd40b-bfa7-4aee-89ea-06b8c7deb304"/>
<column name="KEYID" value="DOWNLOAD"/>
<column name="TITLE" value="Download"/>
<column name="SORTING" valueNumeric="5"/>
<column name="ISACTIVE" valueNumeric="1"/>
<column name="ISESSENTIAL" valueNumeric="1"/>
</insert>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -2,5 +2,7 @@ import("KeywordRegistry_basic");
import("system.result");
result.string(JSON.stringify([
$KeywordRegistry.bulkMailRecipientStatus$sent()
$KeywordRegistry.bulkMailRecipientStatus$sent(),
$KeywordRegistry.bulkMailRecipientStatus$hardBounce(),
$KeywordRegistry.bulkMailRecipientStatus$failed()
]));
\ No newline at end of file
......@@ -642,6 +642,26 @@
<fieldName>ISO3Name</fieldName>
</dependency>
</entityConsumer>
<entityField>
<name>CAMPAIGN_ID</name>
<title>Campaign</title>
<consumer>Campaigns</consumer>
<linkedContext>Campaign</linkedContext>
</entityField>
<entityConsumer>
<name>Campaigns</name>
<dependency>
<name>dependency</name>
<entityName>Campaign_entity</entityName>
<fieldName>Campaigns</fieldName>
</dependency>
<children>
<entityParameter>
<name>OnlyActive_param</name>
<valueProcess>%aditoprj%/entity/BulkMail_entity/entityfields/campaigns/children/onlyactive_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityParameter>
<name>PresetRecipientsRecordsRecipe_param</name>
<expose v="true" />
......@@ -808,6 +828,14 @@
<expression>%aditoprj%/entity/BulkMail_entity/recordcontainers/db/recordfieldmappings/firstsenddate.value/expression.js</expression>
<isFilterable v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>CAMPAIGN_ID.value</name>
<recordfield>BULKMAIL.CAMPAIGN_ID</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>CAMPAIGN_ID.displayValue</name>
<expression>%aditoprj%/entity/BulkMail_entity/recordcontainers/db/recordfieldmappings/campaign_id.displayvalue/expression.js</expression>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>dateLastEdit.value</name>
<expression>%aditoprj%/entity/BulkMail_entity/recordcontainers/db/recordfieldmappings/datelastedit.value/expression.js</expression>
......
......@@ -3,7 +3,7 @@ import("system.result");
import("system.neon");
import("KeywordRegistry_basic");
if( vars.get("$field.STATUS") == $KeywordRegistry.bulkMailStatus$sent())
if( vars.get("$field.STATUS") == $KeywordRegistry.bulkMailStatus$sent() || (vars.get("$field.STATUS") == $KeywordRegistry.bulkMailStatus$adHoc() && vars.get("$field.deliveredMailCount") > 0))
{
result.string(neon.COMPONENTSTATE_READONLY);
}
......
import("system.result");
result.string(true);
\ No newline at end of file
......@@ -3,5 +3,5 @@ import("Bulkmail_lib");
import("system.result");
import("system.neon");
if (BulkMailUtils.isStatusSendingOrSent(vars.get("$field.STATUS")))
if (BulkMailUtils.isStatusSendingSentOrAdHoc(vars.get("$field.STATUS")))
result.string(neon.COMPONENTSTATE_READONLY);
\ No newline at end of file
import("system.result");
import("Sql_lib");
result.string(newSelect("CAMPAIGN.NAME")
.from("CAMPAIGN")
.where("BULKMAIL.CAMPAIGN_ID = CAMPAIGN.CAMPAIGNID")
.toString())
\ No newline at end of file
......@@ -3,4 +3,5 @@ import("system.vars");
import("system.result");
result.object(vars.get("$field.KIND") != $KeywordRegistry.documentTemplateType$attachment()
&& vars.get("$field.KIND") != $KeywordRegistry.documentTemplateType$signature());
\ No newline at end of file
&& vars.get("$field.KIND") != $KeywordRegistry.documentTemplateType$signature()
&& (vars.get("$field.KIND") != $KeywordRegistry.documentTemplateType$download()));
\ No newline at end of file
......@@ -5,6 +5,7 @@ import("system.result");
import("system.neon");
if((vars.get("$field.KIND") == $KeywordRegistry.documentTemplateType$attachment()
|| (vars.get("$field.KIND") == $KeywordRegistry.documentTemplateType$download())
|| vars.get("$field.KIND") == $KeywordRegistry.documentTemplateType$signature()
|| vars.get("$field.KIND") == $KeywordRegistry.documentTemplateType$replymail())
|| (vars.get("$field.KIND") == $KeywordRegistry.documentTemplateType$letter()
......
......@@ -97,6 +97,10 @@
<name>cd711f0c-20b7-4f1a-8bca-2e1cf420bb6d</name>
<entityField>ISOLANGUAGE</entityField>
</entityFieldLink>
<entityFieldLink>
<name>651e0144-57e6-4559-9b73-4e7ae23e4a0a</name>
<entityField>CAMPAIGN_ID</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
<genericViewTemplate>
......
......@@ -79,6 +79,10 @@
<name>8f811e5a-0477-4ba8-8f6e-fbb390833459</name>
<entityField>EMPLOYEE_CONTACT_ID</entityField>
</entityFieldLink>
<entityFieldLink>
<name>b036373c-fb1a-4f1d-ab75-adee3728f2f5</name>
<entityField>CAMPAIGN_ID</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
<neonViewReference>
......
<?xml version="1.0" encoding="UTF-8"?>
<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.2" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.2">
<name>AddToAdHocMailing_workflowService</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<process>%aditoprj%/process/AddToAdHocMailing_workflowService/process.js</process>
<alias>Data_alias</alias>
<serviceTaskParameterProcess>%aditoprj%/process/AddToAdHocMailing_workflowService/serviceTaskParameterProcess.js</serviceTaskParameterProcess>
<variants>
<element>WORKFLOW</element>
</variants>
</process>
import("system.vars");
import("Communication_lib");
import("Bulkmail_lib");
import("system.workflow");
var processInstanceId = vars.get("$local.uid");
var variables = JSON.parse(vars.get("$local.value"));
var recipientContactId = variables.contactId || variables.targetId;
var bulkMailId = variables.bulkMailId;
var recipientEmail = variables.recipientEmail || CommUtil.getStandardMail(recipientContactId);
var originUrl = variables.originUrl;
var workflowKey = variables.workflowKey;
var additionalLinkParameters = {
workflowinstance: processInstanceId,
workflowkey: workflowKey
};
BulkMailUtils.addToAdHocMail(bulkMailId, recipientContactId, recipientEmail, additionalLinkParameters, originUrl)
\ No newline at end of file
import("system.result");
import("Workflow_lib");
import("KeywordRegistry_basic");
import("Sql_lib");
var adHocMails = newSelect(["BULKMAIL.BULKMAILID","BULKMAIL.NAME"])
.from("BULKMAIL")
.where("BULKMAIL.STATUS",$KeywordRegistry.bulkMailStatus$adHoc())
.table()
.map(function ([pId, pName])
{
return {
id:pId,
name:pName
}
});
var parameters = [
new WorkflowServiceTaskParameter("bulkMailId", "Ad Hoc Mailing", WorkflowServiceTaskParameter.ENUM(), adHocMails)
];
result.object(parameters);
......@@ -72,11 +72,19 @@ BulkMailUtils.sendBulkMailOnServer = function (pBulkMailId, pTestRun, pUser)
* True indicates a Testrun<br>
* @param {Bool} pUser (optional) <p>
* If there are no test recipients or no recipients marked for a test replacement in a test run
* we send an email to this user instead<br>
* we send an email to this user instead<br>
* @param {Object} pAdditionalLinkParameters(optional)<p>
* Additional parameters that get put into the weblinks for the redirect webservice.
* Expects object of key value pairs. <br>
* @param {String} pAdHochMailingRecipientId (optional) <p>
* The id of a recipient added to a adhoc mailing list. The mailing ignores all other recipients if this parameter is set<br>
* @param {String} pOriginUrl (optional) <p>
* Base URL for link replacement. Only needed when sending an Ad-Hoc Mailing without a configured baseReplacementURL in the Configuration <br>
* since sys.origin does not exist during workflowactions.
* @return {Object} <p>
* Count of sucessful and failed mails.<br>
*/
BulkMailUtils.sendBulkMail = function (pBulkMailId, pIsTestRun, pUser)
BulkMailUtils.sendBulkMail = function (pBulkMailId, pIsTestRun, pUser, pAdditionalLinkParameters, pAdHochMailingRecipientId, pOriginUrl)
{
if (pIsTestRun == undefined)
{
......@@ -103,6 +111,11 @@ BulkMailUtils.sendBulkMail = function (pBulkMailId, pIsTestRun, pUser)
.addParameter("BulkMailId_param", pBulkMailId)
.addParameter("IsTestMail_param", pIsTestRun);
if(pAdHochMailingRecipientId)
{
recipientLoadConfig.uid(pAdHochMailingRecipientId);
}
recipientData = entities.getRows(recipientLoadConfig);
var blacklist = new CommunicationBlacklist().loadBlacklistRecipients(pBulkMailId);
......@@ -147,7 +160,21 @@ BulkMailUtils.sendBulkMail = function (pBulkMailId, pIsTestRun, pUser)
return contactId;
});
var baseUrl = project.getInstanceConfigValue("custom.bulkmail.baseReplacementURL", vars.get("$sys.origin")) + "/services/rest/redirect_rest?";
var baseUrl = (pOriginUrl || project.getInstanceConfigValue("custom.bulkmail.baseReplacementURL", vars.get("$sys.origin"))) + "/services/rest/redirect_rest?";
var additionalParameterString = "";
if (pAdditionalLinkParameters)
{
additionalParameterString = "&" + Object.keys(pAdditionalLinkParameters)
.map(function (key)
{
return key + "=" + pAdditionalLinkParameters[key]
})
.join("&");
}
var linkPlaceholders = newSelect(["PLACEHOLDER", "WEBLINKID", "URL", "ISREDIRECT"])
.from("WEBLINK")
.table()
......@@ -157,7 +184,7 @@ BulkMailUtils.sendBulkMail = function (pBulkMailId, pIsTestRun, pUser)
{
var linkFn = function (pContactId)
{
return baseUrl + "link=" + weblinkId + "&log=" + mailLogIds.get(pContactId);
return baseUrl + "link=" + weblinkId + "&log=" + mailLogIds.get(pContactId) + additionalParameterString;
}
return new Placeholder(placeholder, Placeholder.types.CALLBACKFUNCTION, linkFn);
}
......@@ -166,7 +193,7 @@ BulkMailUtils.sendBulkMail = function (pBulkMailId, pIsTestRun, pUser)
var webviewFn = function(pContactId)
{
return vars.get("$sys.origin")+"/services/rest/webview_rest?" + "log=" + mailLogIds.get(pContactId);
return (pOriginUrl || project.getInstanceConfigValue("custom.bulkmail.baseReplacementURL", vars.get("$sys.origin"))) + "/services/rest/webview_rest?" + "log=" + mailLogIds.get(pContactId);
}
var webviewPlaceholder = new Placeholder("webview", Placeholder.types.CALLBACKFUNCTION, webviewFn);
......@@ -326,10 +353,13 @@ BulkMailUtils.sendBulkMail = function (pBulkMailId, pIsTestRun, pUser)
"DATE_RUN_FINISHED": vars.get("$sys.date")
});
newWhere("BULKMAIL.BULKMAILID", pBulkMailId)
if(!pAdHochMailingRecipientId)
{
newWhere("BULKMAIL.BULKMAILID", pBulkMailId)
.updateFields({
"STATUS": $KeywordRegistry.bulkMailStatus$sent()
});
});
}
}
else
{
......@@ -695,6 +725,37 @@ BulkMailUtils.filterNewRecipientsByCondition = function (pBulkMailId, pCondition
}
return condition.arrayColumn();
}
/*
* adds a Recipient to an ad hoc mailing list and sends the mail.
*
* @param {String} pBulkMailId id of the bulk mail the contact should be added to
* @param {String} pContactId id of the contact that gets added
* @param {String} pEmailAddress address the ad hoc mailing gets sent to.
* @param {Object} pAdditionalLinkParameters(optional)<p>
* Additional parameters that get put into the weblinks for the redirect webservice.
* Expects object of key value pairs. <br>
* @param {String} pOriginUrl Base URL for link replacement.
*/
BulkMailUtils.addToAdHocMail = function (pBulkMailId, pContactId, pEmailAddress, pAdditionalLinkParameters, pOriginUrl)
{
if(!pBulkMailId || !pContactId)
{
return;
}
var bulkMailRecipientId = util.getNewUUID();
new SqlBuilder().insertFields({
"BULKMAILRECIPIENTID": bulkMailRecipientId,
"BULKMAIL_ID": pBulkMailId,
"CONTACT_ID": pContactId,
"STATUS": $KeywordRegistry.bulkMailRecipientStatus$pending(),
"EMAIL_ADDRESS": pEmailAddress
},
"BULKMAILRECIPIENT");
this.sendBulkMail(pBulkMailId, false, false, pAdditionalLinkParameters, bulkMailRecipientId, pOriginUrl);
}
/**
* Filters the given contactIds if they can be added as new recipients.
......@@ -828,6 +889,21 @@ BulkMailUtils.isStatusSendingOrSent = function (pStatus)
return pStatus == $KeywordRegistry.bulkMailStatus$sent() || pStatus == $KeywordRegistry.bulkMailStatus$beingSent()
}
/**
* Checks whether the given status id matches,<br>
* to the status of a bulk mail which is sent or<br>
* not.
*
* @param {String} pStatus <p>
* The key id of the current status.<br>
* @return {Boolean} <p>
* True if the status is "sent" or "sending".<br>
*/
BulkMailUtils.isStatusSendingSentOrAdHoc = function (pStatus)
{
return pStatus == $KeywordRegistry.bulkMailStatus$sent() || pStatus == $KeywordRegistry.bulkMailStatus$beingSent() || pStatus == $KeywordRegistry.bulkMailStatus$adHoc()
}
/**
* Opens BulkMail context in new mode, with the given bulk mail id.<br>
*
......
......@@ -216,6 +216,7 @@ $KeywordRegistry.documentTemplateType$letter = function(){return "LET";};
$KeywordRegistry.documentTemplateType$textModular = function(){return "TEX";};
$KeywordRegistry.documentTemplateType$mail = function(){return "MAI";};
$KeywordRegistry.documentTemplateType$attachment = function(){return "ATT";};
$KeywordRegistry.documentTemplateType$download = function(){return "DOWNLOAD";};
$KeywordRegistry.documentTemplateType$signature = function(){return "SIGNATURE";};
$KeywordRegistry.documentTemplateType$replymail = function(){return "REPLY_MAIL";};
......@@ -288,6 +289,7 @@ $KeywordRegistry.bulkMailStatus$beingSent = function(){return "BULKMAILBEINGSENT
$KeywordRegistry.bulkMailStatus$sent = function(){return "BULKMAILSENT";};
$KeywordRegistry.bulkMailStatus$planned = function(){return "BULKMAILPLANNED";};
$KeywordRegistry.bulkMailStatus$missed = function(){return "BULKMAILMISSED";};
$KeywordRegistry.bulkMailStatus$adHoc = function(){return "BULKMAILADHOC";};
$KeywordRegistry.serialLetterStatus = function(){return "SerialLetterStatus";};
$KeywordRegistry.serialLetterStatus$notSent = function(){return "SERIALLETTERNOTSENT";};
......
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