Skip to content
Snippets Groups Projects
Commit 08c33c69 authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

warning on ampaign participants which have any commrestriction

parent e74ad7fb
No related branches found
No related tags found
No related merge requests found
Showing
with 102 additions and 36 deletions
......@@ -190,7 +190,7 @@
<name>ADVERTISINGBAN_ICON</name>
<colorProcess>%aditoprj%/entity/CampaignParticipant_entity/entityfields/advertisingban_icon/colorProcess.js</colorProcess>
<contentType>IMAGE</contentType>
<valueProcess>%aditoprj%/entity/CampaignParticipant_entity/entityfields/advertisingban_icon/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/CampaignParticipant_entity/entityfields/advertisingban_icon/displayValueProcess.js</displayValueProcess>
</entityField>
<entityConsumer>
<name>ParticipantsCommRestiction</name>
......@@ -277,10 +277,6 @@
<name>CAMPAIGNPARTICIPANTID.displayValue</name>
<recordfield>CAMPAIGNPARTICIPANT.CAMPAIGNPARTICIPANTID</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>ADVERTISINGBAN.value</name>
<expression>%aditoprj%/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/advertisingban.value/expression.js</expression>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>STANDARD_PHONE_COMMUNICATION.displayValue</name>
<expression>%aditoprj%/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/standard_phone_communication.displayvalue/expression.js</expression>
......@@ -289,6 +285,10 @@
<name>STANDARD_EMAIL_COMMUNICATION.displayValue</name>
<expression>%aditoprj%/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/standard_email_communication.displayvalue/expression.js</expression>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>ADVERTISINGBAN_ICON.value</name>
<expression>%aditoprj%/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/advertisingban_icon.value/expression.js</expression>
</dbRecordFieldMapping>
</recordFieldMappings>
</dbRecordContainer>
</recordContainers>
......
......@@ -4,12 +4,10 @@ import("system.db");
import("system.vars");
import("system.neon");
import("Campaign_lib");
var commres = CampaignUtils.checkforCommRestrictions(vars.get("$field.CONTACT_ID"), vars.get("$field.CAMPAIGNSTEP_ID"));
if(commres)
if(vars.get("$field.ADVERTISINGBAN_ICON") > 0)
{
result.string(neon.PRIORITY_HIGH_COLOR);
result.string(neon.PRIORITY_MEDIUM_COLOR);
}
else
{
......
import("system.result");
import("system.vars");
// Now show warning always, if any commrestriction exists. No matter which medium the current step has.
if (vars.get("$field.ADVERTISINGBAN_ICON") == 0)
{
result.string("VAADIN:CHECK");
}
else
{
result.string("VAADIN:WARNING");
}
\ No newline at end of file
import("system.vars");
import("system.result");
import("KeywordRegistry_basic");
import("Keyword_lib");
import("Sql_lib");
import("system.db");
import("Campaign_lib");
var commres = CampaignUtils.checkforCommRestrictions(vars.get("$field.CONTACT_ID"), vars.get("$field.CAMPAIGNSTEP_ID"));
if(commres)
{
var keywordAttributes = KeywordUtils.getAttributeRelationsByKey(commres, $KeywordRegistry.communicationMediumCampaign())
result.string(keywordAttributes.AdvertisingBanIcon);
}
else
{
result.string("VAADIN:CHECK");
}
\ No newline at end of file
import("system.result");
result.string("(select MEDIUM from CAMPAIGNSTEP \n\
join COMMRESTRICTION on MEDIUM = STEPMEDIUM \n\
where COMMRESTRICTION.CONTACT_ID = CAMPAIGNPARTICIPANT.CONTACT_ID \n\
and CAMPAIGNSTEP.CAMPAIGNSTEPID = CAMPAIGNPARTICIPANT.CAMPAIGNSTEP_ID)");
\ No newline at end of file
import("system.vars");
import("Contact_lib");
import("Sql_lib");
import("system.result");
// Now show warning always, if any commrestriction exists. No matter which medium the current step has.
result.string("(" + newSelect("count(*)")
.from("CONTACT")
.where("CONTACT.CONTACTID = CAMPAIGNPARTICIPANT.CONTACT_ID")
.and(newWhere(ContactUtils.getCommRestrictionCondition(undefined, false, vars.get("$sys.date"))))
.toString() + ")");
\ No newline at end of file
......@@ -1148,6 +1148,12 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
<entityField>
<name>LEAD_LEADID</name>
</entityField>
<entityField>
<name>COMMRESTRICTIONS_ACTIVE</name>
<title>Commrestrictions</title>
<color>$priority-high-color</color>
<displayValueProcess>%aditoprj%/entity/Person_entity/entityfields/commrestrictions_active/displayValueProcess.js</displayValueProcess>
</entityField>
</entityFields>
<recordContainers>
<dbRecordContainer>
......@@ -1400,6 +1406,10 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
<isFilterable v="true" />
<filtertype>BASIC</filtertype>
</consumerMapping>
<dbRecordFieldMapping>
<name>COMMRESTRICTIONS_ACTIVE.value</name>
<expression>%aditoprj%/entity/Person_entity/recordcontainers/db/recordfieldmappings/commrestrictions_active.value/expression.js</expression>
</dbRecordFieldMapping>
</recordFieldMappings>
<filterExtensions>
<filterExtensionSet>
......
import("system.vars");
import("system.translate");
import("system.result");
if (vars.get("$field.COMMRESTRICTIONS_ACTIVE").trim())
{
result.string(translate.text("No advertising by") + " " + vars.get("$field.COMMRESTRICTIONS_ACTIVE").trim());
}
import("system.vars");
import("system.result");
import("Sql_lib");
import("Keyword_lib");
import("KeywordRegistry_basic");
var mediumList = KeywordUtils.getEntryNamesAndIdsByContainer($KeywordRegistry.communicationMediumCampaign());
var sqlMasking = new SqlMaskingUtils();
var parts = [];
var orgContactSubselect = newSelect("orgContact.CONTACTID")
.from("CONTACT anyContact")
.join("CONTACT orgContact", newWhere("anyContact.ORGANISATION_ID = orgContact.ORGANISATION_ID")
.and("orgContact.PERSON_ID IS NULL"))
.where("anyContact.CONTACTID = CONTACT.CONTACTID")
mediumList.forEach(function(pMedium)
{
var subquery = newSelect("COMMRESTRICTION.MEDIUM, COMMRESTRICTIONID")
.from("COMMRESTRICTION")
.where("COMMRESTRICTION.MEDIUM", pMedium[0])
.and("COMMRESTRICTION.STARTDATE", vars.get("$sys.date"), "# <= ?")
.and(newWhere()
.or("COMMRESTRICTION.CONTACT_ID = CONTACT.CONTACTID")
.or("COMMRESTRICTION.CONTACT_ID", orgContactSubselect));
parts.push("case when exists(" + subquery.toString() + ") then '" + pMedium[1] + "' else '' end");
})
result.string(sqlMasking.concat(parts, ", ", false));
\ No newline at end of file
......@@ -5915,6 +5915,12 @@
<entry>
<key>File from this template could not be found anymore. Please go to the template and upload a new file.</key>
</entry>
<entry>
<key>Commrestrictions</key>
</entry>
<entry>
<key>No advertising by</key>
</entry>
</keyValueMap>
<font name="Dialog" style="0" size="11" />
<sqlModels>
......
......@@ -7431,6 +7431,13 @@
<key>File from this template could not be found anymore. Please go to the template and upload a new file.</key>
<value>Die Datei dieser Vorlage konnte nicht mehr gefunden werde. Bitte laden Sie bei der Dokumentvorlage eine neue Datei hoch.</value>
</entry>
<entry>
<key>Commrestrictions</key>
</entry>
<entry>
<key>No advertising by</key>
<value>Keine Werbung durch</value>
</entry>
</keyValueMap>
<font name="Dialog" style="0" size="11" />
</language>
......@@ -5965,6 +5965,12 @@
<entry>
<key>File from this template could not be found anymore. Please go to the template and upload a new file.</key>
</entry>
<entry>
<key>Commrestrictions</key>
</entry>
<entry>
<key>No advertising by</key>
</entry>
</keyValueMap>
<font name="Dialog" style="0" size="11" />
</language>
......@@ -17,6 +17,7 @@
<descriptionField>ORGANISATION_CONTACTID</descriptionField>
<favoriteAction1>newActivity</favoriteAction1>
<entityField>#ENTITY</entityField>
<informationField>COMMRESTRICTIONS_ACTIVE</informationField>
</cardViewTemplate>
<neonViewReference>
<name>5a1b7683-2fec-4763-9b45-e4c7a18d70fd</name>
......@@ -36,6 +37,7 @@
<genericViewTemplate>
<name>Info</name>
<showDrawer v="true" />
<hideEmptyFields v="true" />
<entityField>#ENTITY</entityField>
<fields>
<entityFieldLink>
......
......@@ -456,7 +456,7 @@ ContactUtils.getDefaultAddressId = function(pContactId)
/**
* makes a SqlCondition that checks if there's (not) a commrestriction for a contact
*
* @param {String} pMedium medium to check
* @param {String} [pMedium=undefined] medium to check if undefined, don't check it
* @param {boolean} [pNoRestriction=false] if true, the condition gets every contact that has no
* a commrestriction, otherwise every contact that has a commrestriction
* @param {String|Number} [pStartDate=current date] date to check against the start date of the commrestriction
......@@ -471,7 +471,7 @@ ContactUtils.getCommRestrictionCondition = function (pMedium, pNoRestriction, pS
.select("COMMRESTRICTIONID")
.from("COMMRESTRICTION")
.where(SqlCondition.begin()
.andPrepare("COMMRESTRICTION.MEDIUM", pMedium)
.andPrepareIfSet("COMMRESTRICTION.MEDIUM", pMedium)
.andPrepare("COMMRESTRICTION.STARTDATE", pStartDate, "# <= ?")
.and(SqlCondition.begin()
// check contactid
......
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