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

merged origin/2020.1 into master

parents efe5a81d f6e2ffd0
No related branches found
No related tags found
No related merge requests found
Showing
with 178 additions and 19 deletions
......@@ -58,6 +58,25 @@
<state>EDITABLE</state>
<valueProcess>%aditoprj%/entity/BulkMailAddRecipients_entity/entityfields/recipientcount/valueProcess.js</valueProcess>
</entityField>
<entityParameter>
<name>comingFrom_param</name>
<expose v="true" />
</entityParameter>
<entityField>
<name>currentRecipients</name>
<documentation>%aditoprj%/entity/BulkMailAddRecipients_entity/entityfields/currentrecipients/documentation.adoc</documentation>
<title>Current Recipients</title>
<valueProcess>%aditoprj%/entity/BulkMailAddRecipients_entity/entityfields/currentrecipients/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>notAddedRecipients</name>
</entityField>
<entityField>
<name>futureRecipients</name>
<documentation>%aditoprj%/entity/BulkMailAddRecipients_entity/entityfields/futurerecipients/documentation.adoc</documentation>
<title>Recipients after adding</title>
<valueProcess>%aditoprj%/entity/BulkMailAddRecipients_entity/entityfields/futurerecipients/valueProcess.js</valueProcess>
</entityField>
</entityFields>
<recordContainers>
<datalessRecordContainer>
......
== currentRecipients;
needed for the score card, to display extra information.
import("system.logging");
import("system.result");
import("system.vars");
import("Sql_lib");
var currentCount = newSelect("count(BULKMAILRECIPIENT.CONTACT_ID)")
.from("BULKMAILRECIPIENT")
.where("BULKMAILRECIPIENT.BULKMAIL_ID", vars.get("$field.BULKMAIL_ID"))
.cell()
if(currentCount)
result.string(currentCount)
else
result.string("0")
== futureRecipients;
needed for the score card, to display extra information.
import("system.vars");
import("system.result");
import("system.eMath")
var res = eMath.addInt(vars.get("$field.recipientCount"), vars.get("$field.currentRecipients"));
if(res)
result.string(res);
else
result.string(0);
\ No newline at end of file
import("system.eMath");
import("FilterviewMenuAction_lib");
import("Contact_lib");
import("system.result");
import("Bulkmail_lib");
import("KeywordRegistry_basic");
import("system.util");
import("system.db");
import("Sql_lib");
import("system.vars");
import("system.neon");
var selection = JSON.parse(vars.getString("$param.ContactIds_param"));
var comingfrom = vars.getString("$param.comingFrom_param");
var contactIds;
if(!Array.isArray(selection)) //if selection is an array, data has been selected
{
var condition = selection.condition;
if(comingfrom == "Organisation")
contactIds = FilterviewMenuActionUtils.organisationIdsFilter(condition);
else if (comingfrom == "Person")
contactIds = FilterviewMenuActionUtils.contactIdsFilter(condition);
}
var contactIds = JSON.parse(vars.getString("$param.ContactIds_param"));
var bulkMailId = vars.get("$field.BULKMAIL_ID");
var res;
if (bulkMailId)
res = JSON.stringify(BulkMailUtils.filterNewRecipients(bulkMailId, contactIds));
{
var recipients = BulkMailUtils.filterNewRecipients(bulkMailId, contactIds);
res = JSON.stringify(recipients);
neon.setFieldValue("$field.notAddedRecipients", eMath.subInt(parseInt(contactIds.length), parseInt(recipients.length)));
}
else
res = null;
......
......@@ -2,14 +2,21 @@ import("system.translate");
import("system.result");
import("system.vars");
var count = vars.getString("$field.recipientCount")
var count = vars.get("$field.recipientCount")
var res = "";
var resNotAdded = "\n\
";
if (count && !vars.get("$sys.validationerrors"))
{
if (count == "0")
res = translate.text("No new recipients found that can be added to the bulk mail.");
else
{
res = translate.withArguments("%0 new recipients will be added to the bulk mail.", [count]);
var notAdded = vars.get("$field.notAddedRecipients")
if (notAdded > 0)
resNotAdded += translate.withArguments("%0 of the chosen records are already recipients or don't have an e-mail set", [notAdded]);
}
}
result.string(res);
\ No newline at end of file
result.string(res + resNotAdded);
\ No newline at end of file
......@@ -35,12 +35,13 @@
<consumer>CampaignStepConsumer</consumer>
<mandatory v="true" />
<state>EDITABLE</state>
<valueProcess>%aditoprj%/entity/CampaignAddParticipants_entity/entityfields/campaignstep_id/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/CampaignAddParticipants_entity/entityfields/campaignstep_id/displayValueProcess.js</displayValueProcess>
<onValueChange>%aditoprj%/entity/CampaignAddParticipants_entity/entityfields/campaignstep_id/onValueChange.js</onValueChange>
</entityField>
<entityField>
<name>campaignParticipantMessage</name>
<state>EDITABLE</state>
<valueProcess>%aditoprj%/entity/CampaignAddParticipants_entity/entityfields/campaignparticipantmessage/valueProcess.js</valueProcess>
<onValueChangeTypes>
<element>PROCESS</element>
</onValueChangeTypes>
......@@ -102,15 +103,17 @@
</entityConsumer>
<entityField>
<name>campaignStepCurrentParticipantCount</name>
<documentation>%aditoprj%/entity/CampaignAddParticipants_entity/entityfields/campaignstepcurrentparticipantcount/documentation.adoc</documentation>
<title>Current participants</title>
<state>EDITABLE</state>
<displayValueProcess>%aditoprj%/entity/CampaignAddParticipants_entity/entityfields/campaignstepcurrentparticipantcount/displayValueProcess.js</displayValueProcess>
</entityField>
<entityField>
<name>campaignStepMaxParticipantCount</name>
<documentation>%aditoprj%/entity/CampaignAddParticipants_entity/entityfields/campaignstepmaxparticipantcount/documentation.adoc</documentation>
<title>Max participants</title>
<state>EDITABLE</state>
<displayValueProcess>%aditoprj%/entity/CampaignAddParticipants_entity/entityfields/campaignstepmaxparticipantcount/displayValueProcess.js</displayValueProcess>
<valueProcess>%aditoprj%/entity/CampaignAddParticipants_entity/entityfields/campaignstepmaxparticipantcount/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>isUpdate</name>
......@@ -138,6 +141,16 @@
<state>DISABLED</state>
<stateProcess>%aditoprj%/entity/CampaignAddParticipants_entity/entityfields/addparticipants/stateProcess.js</stateProcess>
</entityActionField>
<entityField>
<name>campaignparticipantContactIds</name>
<documentation>%aditoprj%/entity/CampaignAddParticipants_entity/entityfields/campaignparticipantcontactids/documentation.adoc</documentation>
<title></title>
<valueProcess>%aditoprj%/entity/CampaignAddParticipants_entity/entityfields/campaignparticipantcontactids/valueProcess.js</valueProcess>
</entityField>
<entityParameter>
<name>comingFrom_param</name>
<expose v="true" />
</entityParameter>
</entityFields>
<recordContainers>
<jDitoRecordContainer>
......
......@@ -22,7 +22,7 @@ if(participantRowIds != null && participantRowIds.length > 0)
let contactIdsToHandle = participantRowIds;
if(isUpdate == "false")
contactIdsToHandle = CampaignUtils.GetContactIdsNotInCampaignByRowIds(campaignId, participantRowIds);
contactIdsToHandle = vars.get("$field.campaignparticipantContactIds");
_handleRowIds(contactIdsToHandle, campaignId);
}
......
== campaignparticipantContactIds;
The ContactIds or OrganisationIds of the selected/filtered records.
\ No newline at end of file
import("Campaign_lib");
import("system.eMath");
import("FilterviewMenuAction_lib");
import("system.result");
import("system.vars");
import("system.neon");
if(vars.get("$field.CAMPAIGN_ID"))
{
var comingfrom = vars.getString("$param.dataSourceTableName_param");
var contactIds;
var filteredContactIds;
var selection = vars.getString("$param.campaignParticipantsRowIds_param");
if(vars.exists("$param.campaignParticipantsCondition_param") && vars.get("$param.campaignParticipantsCondition_param"))
{
selection = JSON.parse(vars.getString("$param.campaignParticipantsCondition_param")).condition;
if(comingfrom == "Organisation")
filteredContactIds = FilterviewMenuActionUtils.organisationIdsFilter(selection);
else if(comingfrom == "Person")
filteredContactIds = FilterviewMenuActionUtils.contactIdsFilter(selection)
contactIds = CampaignUtils.GetContactIdsNotInCampaignByRowIds(vars.get("$field.CAMPAIGN_ID"), filteredContactIds);
}
else
{
contactIds = CampaignUtils.GetContactIdsNotInCampaignByRowIds(vars.get("$field.CAMPAIGN_ID"), JSON.parse(selection));
}
result.string(JSON.stringify(contactIds));
}
\ No newline at end of file
import("system.eMath");
import("FilterviewMenuAction_lib");
import("system.translate");
import("system.result");
import("system.vars");
var res = "";
var resNotAdded = "\n\
";
if(vars.get("$field.CAMPAIGN_ID") && vars.get("$field.campaignparticipantContactIds") && !vars.get("$sys.validationerrors"))
{
var validCount = JSON.parse(vars.get("$field.campaignparticipantContactIds")).length;
var selectedIds;
var comingfrom = vars.get("$param.dataSourceTableName_param");
if (validCount && !vars.get("$sys.validationerrors") && vars.get("$field.CAMPAIGN_ID"))
{
if (validCount != 0)
{
res = translate.withArguments("%0 new participants will be added to the campaign.", [validCount]);
if(vars.exists("$param.campaignParticipantsRowIds_param") && vars.getString("$param.campaignParticipantsRowIds_param"))
selectedIds = JSON.parse(vars.getString("$param.campaignParticipantsRowIds_param")).length;
else
{
var selection = JSON.parse(vars.getString("$param.campaignParticipantsCondition_param")).condition;
if(comingfrom == "Organisation")
selectedIds = FilterviewMenuActionUtils.organisationIdsFilter(selection).length;
else if(comingfrom == "Person")
selectedIds = FilterviewMenuActionUtils.contactIdsFilter(selection).length;
}
var alreadyParticipant = eMath.subInt(selectedIds, validCount)
resNotAdded += translate.withArguments("%0 of the chosen records are already in the campaign", [alreadyParticipant]);
}
}
}
result.string(res + resNotAdded);
\ No newline at end of file
import("system.neon");
neon.refresh(["$field.campaignParticipantMessage"])
\ No newline at end of file
== campaignStepCurrentParticipantCount;
needed for the score card, to display extra information.
== campaignStepMaxParticipantCount;
needed for the score card, to display extra information.
import("system.result");
import("system.vars");
import("Campaign_lib");
result.string(CampaignUtils.getMaxParticipantCountForStep(vars.get("$field.CAMPAIGNSTEP_ID")));
\ No newline at end of file
import("system.result");
import("system.vars");
import("Campaign_lib");
if(vars.get("$field.CAMPAIGNSTEP_ID"))
result.string(CampaignUtils.getMaxParticipantCountForStep(vars.get("$field.CAMPAIGNSTEP_ID")));
else
result.string(0)
\ No newline at end of file
......@@ -111,7 +111,6 @@ if(selectedCampaignId != '')
resultValue = "true";
}
}
neon.setFieldValue("$field.campaignParticipantMessage", messageString);
result.string(resultValue);
}
......
import("system.result");
import("system.vars");
//TODO: This dummy implementation shouldn't be nescessary here. Remove this process eventually. #1051003
var rows = [];
if (vars.get("$local.idvalues"))
rows = vars.get("$local.idvalues").map(function (id) {return [id];});
result.object(rows);
\ 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