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

#1062892 CampaignParticipant filter

parent dea6ce65
No related branches found
No related tags found
No related merge requests found
Showing
with 129 additions and 81 deletions
......@@ -3,6 +3,7 @@
<name>AnyContact_entity</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<documentation>%aditoprj%/entity/AnyContact_entity/documentation.adoc</documentation>
<title>Contact</title>
<contentTitleProcess>%aditoprj%/entity/AnyContact_entity/contentTitleProcess.js</contentTitleProcess>
<initFilterProcess>%aditoprj%/entity/AnyContact_entity/initFilterProcess.js</initFilterProcess>
<imageProcess>%aditoprj%/entity/AnyContact_entity/imageProcess.js</imageProcess>
......@@ -29,12 +30,6 @@
<fieldName>AnyContacts</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>336fdc6b-05f8-40bc-89ba-d4ab98bd6948</name>
<entityName>CampaignParticipant_entity</entityName>
<fieldName>AnyContacts</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>b2895709-2ebf-46ec-a46d-6b2e9a4575a3</name>
<entityName>BulkMailRecipient_entity</entityName>
......@@ -77,11 +72,23 @@
<fieldName>Contacts</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>ea7c855e-dccd-4c05-9efb-a1303f37dab8</name>
<entityName>CampaignParticipant_entity</entityName>
<fieldName>AnyContacts</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
</entityProvider>
<entityProvider>
<name>ContactsByIds</name>
<documentation>%aditoprj%/entity/AnyContact_entity/entityfields/contactsbyids/documentation.adoc</documentation>
<children>
<entityParameter>
<name>ContactId_param</name>
<expose v="false" />
</entityParameter>
</children>
<dependencies>
<entityDependency>
<name>0206f7a8-fd58-47e8-8b7a-5ff4531e56fb</name>
......@@ -90,12 +97,6 @@
<isConsumer v="false" />
</entityDependency>
</dependencies>
<children>
<entityParameter>
<name>ContactId_param</name>
<expose v="false" />
</entityParameter>
</children>
</entityProvider>
<entityParameter>
<name>ContactIds_param</name>
......@@ -108,6 +109,7 @@
</entityField>
<entityField>
<name>LANGUAGE</name>
<title>Language</title>
</entityField>
<entityField>
<name>ORGANISATION_ID</name>
......@@ -157,9 +159,11 @@ See ContactUtils.getRelationTypeByPersOrg for possible values</description>
</entityField>
<entityField>
<name>PERSON_TITLE</name>
<title>Title</title>
</entityField>
<entityField>
<name>PERSON_SALUTATION</name>
<title>Salutation</title>
</entityField>
<entityField>
<name>PERSON_FULL_NAME</name>
......@@ -173,6 +177,13 @@ See ContactUtils.getRelationTypeByPersOrg for possible values</description>
<entityProvider>
<name>OnlySameCompany</name>
<documentation>%aditoprj%/entity/AnyContact_entity/entityfields/onlysamecompany/documentation.adoc</documentation>
<children>
<entityParameter>
<name>ContactId_param</name>
<expose v="true" />
<mandatory v="true" />
</entityParameter>
</children>
<dependencies>
<entityDependency>
<name>28b19d6b-237c-4268-b6c6-323df408c94a</name>
......@@ -181,13 +192,6 @@ See ContactUtils.getRelationTypeByPersOrg for possible values</description>
<isConsumer v="false" />
</entityDependency>
</dependencies>
<children>
<entityParameter>
<name>ContactId_param</name>
<expose v="true" />
<mandatory v="true" />
</entityParameter>
</children>
</entityProvider>
<entityParameter>
<name>WithPrivatePersons_param</name>
......@@ -248,6 +252,7 @@ See ContactUtils.getRelationTypeByPersOrg for possible values</description>
<dbRecordFieldMapping>
<name>LANGUAGE.value</name>
<recordfield>CONTACT.ISOLANGUAGE</recordfield>
<isFilterable v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>ORGANISATION_ID.value</name>
......
......@@ -21,20 +21,6 @@
<targetContextField>CONTACTCONTEXT</targetContextField>
<targetIdField>CONTACT_ID</targetIdField>
<documentation>%aditoprj%/entity/CampaignParticipant_entity/entityfields/campaignparticipantsprovider/documentation.adoc</documentation>
<dependencies>
<entityDependency>
<name>f28945cd-4613-4dfa-91f7-a7d9d64cef58</name>
<entityName>Campaign_entity</entityName>
<fieldName>CampaignParticipants</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>7ad08378-b36f-4512-8891-db727c6ddcd7</name>
<entityName>CampaignStep_entity</entityName>
<fieldName>CampaignParticipantsConsumer</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
<children>
<entityParameter>
<name>ContactId_param</name>
......@@ -49,6 +35,20 @@
<expose v="true" />
</entityParameter>
</children>
<dependencies>
<entityDependency>
<name>f28945cd-4613-4dfa-91f7-a7d9d64cef58</name>
<entityName>Campaign_entity</entityName>
<fieldName>CampaignParticipants</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>7ad08378-b36f-4512-8891-db727c6ddcd7</name>
<entityName>CampaignStep_entity</entityName>
<fieldName>CampaignParticipantsConsumer</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
</entityProvider>
<entityParameter>
<name>CampaignStepId_param</name>
......@@ -145,11 +145,6 @@
<entityConsumer>
<name>CampaignSteps</name>
<refreshParent v="true" />
<dependency>
<name>dependency</name>
<entityName>CampaignStep_entity</entityName>
<fieldName>CampaignSteps</fieldName>
</dependency>
<children>
<entityParameter>
<name>campaignId_param</name>
......@@ -157,6 +152,11 @@
<expose v="true" />
</entityParameter>
</children>
<dependency>
<name>dependency</name>
<entityName>CampaignStep_entity</entityName>
<fieldName>CampaignSteps</fieldName>
</dependency>
</entityConsumer>
<entityField>
<name>CONTACTCONTEXT</name>
......@@ -212,17 +212,17 @@
</entityConsumer>
<entityConsumer>
<name>CommRestrictionIcon</name>
<dependency>
<name>dependency</name>
<entityName>KeywordAttribute_entity</entityName>
<fieldName>SpecificContainerKeyword</fieldName>
</dependency>
<children>
<entityParameter>
<name>ContainerName_param</name>
<valueProcess>%aditoprj%/entity/CampaignParticipant_entity/entityfields/commrestrictionicon/children/containername_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
<dependency>
<name>dependency</name>
<entityName>KeywordAttribute_entity</entityName>
<fieldName>SpecificContainerKeyword</fieldName>
</dependency>
</entityConsumer>
<entityField>
<name>STANDARD_EMAIL_COMMUNICATION</name>
......@@ -238,6 +238,12 @@
<name>#PROVIDER_AGGREGATES</name>
<useAggregates v="true" />
</entityProvider>
<entityField>
<name>HASADVERTISINGBAN</name>
<title>Advertising ban</title>
<contentType>BOOLEAN</contentType>
<dropDownProcess>%aditoprj%/entity/CampaignParticipant_entity/entityfields/hasadvertisingban/dropDownProcess.js</dropDownProcess>
</entityField>
</entityFields>
<recordContainers>
<dbRecordContainer>
......@@ -267,6 +273,7 @@
<dbRecordFieldMapping>
<name>CAMPAIGNSTEP_ID.value</name>
<recordfield>CAMPAIGNPARTICIPANT.CAMPAIGNSTEP_ID</recordfield>
<isFilterable v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>CONTACT_ID.value</name>
......@@ -293,16 +300,24 @@
<recordfield>CAMPAIGNPARTICIPANT.CAMPAIGNPARTICIPANTID</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>STANDARD_PHONE_COMMUNICATION.displayValue</name>
<expression>%aditoprj%/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/standard_phone_communication.displayvalue/expression.js</expression>
<name>STANDARD_EMAIL_COMMUNICATION.value</name>
<expression>%aditoprj%/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/standard_email_communication.value/expression.js</expression>
<isFilterable v="true" />
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>STANDARD_EMAIL_COMMUNICATION.displayValue</name>
<expression>%aditoprj%/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/standard_email_communication.displayvalue/expression.js</expression>
<name>STANDARD_PHONE_COMMUNICATION.value</name>
<expression>%aditoprj%/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/standard_phone_communication.value/expression.js</expression>
</dbRecordFieldMapping>
<consumerMapping>
<name>AnyContacts</name>
<filterConditionProcess>%aditoprj%/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/anycontacts/filterConditionProcess.js</filterConditionProcess>
<isFilterable v="true" />
<filtertype>BASIC</filtertype>
</consumerMapping>
<dbRecordFieldMapping>
<name>ADVERTISINGBAN_ICON.value</name>
<expression>%aditoprj%/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/advertisingban_icon.value/expression.js</expression>
<name>HASADVERTISINGBAN.value</name>
<expression>%aditoprj%/entity/CampaignParticipant_entity/recordcontainers/participantsdbrecordcontainer/recordfieldmappings/hasadvertisingban.value/expression.js</expression>
<isFilterable v="true" />
</dbRecordFieldMapping>
</recordFieldMappings>
</dbRecordContainer>
......
import("Util_lib");
import("system.result");
import("Sql_lib");
import("system.db");
import("system.vars");
import("system.neon");
import("Campaign_lib");
if(vars.get("$field.ADVERTISINGBAN_ICON") > 0)
{
result.string(neon.PRIORITY_MEDIUM_COLOR);
}
else
{
result.string(neon.PRIORITY_LOW_COLOR);
}
var hasAdvertisingBan = Utils.toBoolean(vars.get("$field.HASADVERTISINGBAN"));
result.string(hasAdvertisingBan ? neon.PRIORITY_MEDIUM_COLOR : neon.PRIORITY_LOW_COLOR);
\ No newline at end of file
import("Util_lib");
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
var hasAdvertisingBan = Utils.toBoolean(vars.get("$field.HASADVERTISINGBAN"));
result.string(hasAdvertisingBan ? "VAADIN:WARNING" : "VAADIN:CHECK");
\ No newline at end of file
import("system.vars");
import("system.result");
result.string(vars.get("$field.CAMPAIGN_ID"));
\ No newline at end of file
import("system.neon");
if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_TABLE)
result.string(vars.get("$param.CampaignId_param"));
else
result.string(vars.get("$field.CAMPAIGN_ID"));
\ No newline at end of file
import("system.translate");
import("system.result");
result.object([
["1", translate.text("Yes")],
["0", translate.text("No")]
]);
\ 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")))) // TODO: the newWhere can be removed when getCommRestrictionCondition returns a sqlBuilder instead of a SqlCondition
.toString() + ")");
\ No newline at end of file
import("system.result");
import("system.vars");
import("Contact_lib");
import("Sql_lib");
var condition = newWhere(null, ContactUtils.getFullContactSqlBuilder("CONTACTID")
.where("CONTACTID = CAMPAIGNPARTICIPANT.CONTACT_ID")
.and(vars.get("$local.condition")), SqlBuilder.EXISTS());
result.string(condition.toString());
\ No newline at end of file
import("system.vars");
import("Contact_lib");
import("Sql_lib");
import("system.result");
var commRestrictionContactSubSql = newSelect("CONTACT.CONTACTID")
.from("CONTACT")
.where("CONTACT.CONTACTID = CAMPAIGNPARTICIPANT.CONTACT_ID")
.and(ContactUtils.getCommRestrictionCondition());
result.string(SqlBuilder.caseWhen(null, commRestrictionContactSubSql, SqlBuilder.EXISTS()).thenString("1").elseString("0").toString());
\ No newline at end of file
......@@ -434,6 +434,26 @@ ContactUtils.getFullContactString = function()
+ " left join ADDRESS on ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID";
}
/**
* Returns a SqlBuilder for selecting a contact with organisation, person and address.
*
* @param {String|Array|SqlBuilder} [pSelectFields] The select-part to set for the query, if it is omitted, no select will be set.
* @return {SqlBuilder}
*/
ContactUtils.getFullContactSqlBuilder = function (pSelectFields)
{
var sql = new SqlBuilder()
.from("CONTACT")
.join("ORGANISATION", "ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID")
.leftJoin("PERSON", "PERSON.PERSONID = CONTACT.PERSON_ID")
.leftJoin("ADDRESS", "ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID");
if (pSelectFields)
sql.select(pSelectFields);
return sql;
}
/**
* get the addressid of the default address
*
......
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