diff --git a/entity/CommunicationSettings_entity/CommunicationSettings_entity.aod b/entity/CommunicationSettings_entity/CommunicationSettings_entity.aod index eb42697bc6b3d0461535d6cf2386076ff3331ec2..3c3d5fcfcec9ea062aa7822673fa8ec2743e9341 100644 --- a/entity/CommunicationSettings_entity/CommunicationSettings_entity.aod +++ b/entity/CommunicationSettings_entity/CommunicationSettings_entity.aod @@ -149,6 +149,10 @@ <name>ContainerName_param</name> <valueProcess>%aditoprj%/entity/CommunicationSettings_entity/entityfields/mediumkeyword/children/containername_param/valueProcess.js</valueProcess> </entityParameter> + <entityParameter> + <name>BlacklistIds_param</name> + <valueProcess>%aditoprj%/entity/CommunicationSettings_entity/entityfields/mediumkeyword/children/blacklistids_param/valueProcess.js</valueProcess> + </entityParameter> </children> </entityConsumer> <entityConsumer> diff --git a/entity/CommunicationSettings_entity/entityfields/mediumkeyword/children/blacklistids_param/valueProcess.js b/entity/CommunicationSettings_entity/entityfields/mediumkeyword/children/blacklistids_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..283448c24cc389d3355b6057a8c75a21d8ecdd37 --- /dev/null +++ b/entity/CommunicationSettings_entity/entityfields/mediumkeyword/children/blacklistids_param/valueProcess.js @@ -0,0 +1,4 @@ +import("KeywordRegistry_basic"); +import("system.result"); + +result.string(JSON.stringify([$KeywordRegistry.communicationMediumCampaign$letter()])); \ No newline at end of file diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod index 00cb66a88c220143ce86afe6bad350d0aba49dae..d851c8dec53bebe5cea879c60586c91464788af6 100644 --- a/entity/Organisation_entity/Organisation_entity.aod +++ b/entity/Organisation_entity/Organisation_entity.aod @@ -958,7 +958,7 @@ <name>COMMRESTRICTIONS_ACTIVE</name> <title>Commrestrictions</title> <color>$priority-high-color</color> - <displayValueProcess>%aditoprj%/entity/Organisation_entity/entityfields/commrestrictions_active/displayValueProcess.js</displayValueProcess> + <valueProcess>%aditoprj%/entity/Organisation_entity/entityfields/commrestrictions_active/valueProcess.js</valueProcess> </entityField> <entityField> <name>STANDARD_ADDRESS</name> @@ -1652,7 +1652,6 @@ </consumerMapping> <dbRecordFieldMapping> <name>COMMRESTRICTIONS_ACTIVE.value</name> - <expression>%aditoprj%/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/commrestrictions_active.value/expression.js</expression> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>STANDARD_ADDRESS.value</name> diff --git a/entity/Organisation_entity/entityfields/commrestrictions_active/displayValueProcess.js b/entity/Organisation_entity/entityfields/commrestrictions_active/displayValueProcess.js deleted file mode 100644 index 7ab26545fc8d0bb63d06c4382eca2e3ea68e0971..0000000000000000000000000000000000000000 --- a/entity/Organisation_entity/entityfields/commrestrictions_active/displayValueProcess.js +++ /dev/null @@ -1,8 +0,0 @@ -import("system.vars"); -import("system.translate"); -import("system.result"); - -if (vars.get("$field.COMMRESTRICTIONS_ACTIVE").trim()) -{ // bug in SqlMaskingUtils.concat. -> use " " as seperator and replace " " by ", " - result.string(translate.text("No advertising by") + " " + ((vars.get("$field.COMMRESTRICTIONS_ACTIVE")).trim()).replace("/ +/g", ", ")); -} diff --git a/entity/Organisation_entity/entityfields/commrestrictions_active/valueProcess.js b/entity/Organisation_entity/entityfields/commrestrictions_active/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..eb0180412d1da157d1c0c7c2b6cc9de3818d508b --- /dev/null +++ b/entity/Organisation_entity/entityfields/commrestrictions_active/valueProcess.js @@ -0,0 +1,9 @@ +import("Contact_lib"); +import("system.neon"); +import("system.result"); +import("system.vars"); + +if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET) +{ + result.string(ContactUtils.getCommunicationRejectionSummary(vars.get("$field.CONTACTID"))); +} diff --git a/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/commrestrictions_active.value/expression.js b/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/commrestrictions_active.value/expression.js deleted file mode 100644 index 5c633cb5d6343c9ab5546304ab34410b8062adc5..0000000000000000000000000000000000000000 --- a/entity/Organisation_entity/recordcontainers/db/recordfieldmappings/commrestrictions_active.value/expression.js +++ /dev/null @@ -1,4 +0,0 @@ -import("Contact_lib"); -import("system.result"); - -result.string(ContactUtils.getActiveCommRestrictionsSubselect()); \ No newline at end of file diff --git a/entity/Person_entity/Person_entity.aod b/entity/Person_entity/Person_entity.aod index 72bf02195b7bd9839a471c0e09b17c5fa499f25d..1426af8122b324117a06abacfc727d9d6882f1b5 100644 --- a/entity/Person_entity/Person_entity.aod +++ b/entity/Person_entity/Person_entity.aod @@ -939,8 +939,7 @@ <name>COMMRESTRICTIONS_ACTIVE</name> <title>Commrestrictions</title> <color>$priority-high-color</color> - <groupable v="true" /> - <displayValueProcess>%aditoprj%/entity/Person_entity/entityfields/commrestrictions_active/displayValueProcess.js</displayValueProcess> + <valueProcess>%aditoprj%/entity/Person_entity/entityfields/commrestrictions_active/valueProcess.js</valueProcess> </entityField> <entityField> <name>STANDARD_ZIP</name> @@ -1618,7 +1617,6 @@ </consumerMapping> <dbRecordFieldMapping> <name>COMMRESTRICTIONS_ACTIVE.value</name> - <expression>%aditoprj%/entity/Person_entity/recordcontainers/db/recordfieldmappings/commrestrictions_active.value/expression.js</expression> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>STANDARD_ADDRESS.value</name> @@ -1693,6 +1691,9 @@ <isFilterable v="true" /> <filtertype>EXTENDED</filtertype> </consumerMapping> + <consumerMapping> + <name>ContactCommunicationSettings</name> + </consumerMapping> </recordFieldMappings> <linkInformation> <linkInformation> diff --git a/entity/Person_entity/entityfields/commrestrictions_active/displayValueProcess.js b/entity/Person_entity/entityfields/commrestrictions_active/displayValueProcess.js deleted file mode 100644 index 89026aeebe7406ed9dd9fb3b6e618c9cb6dac561..0000000000000000000000000000000000000000 --- a/entity/Person_entity/entityfields/commrestrictions_active/displayValueProcess.js +++ /dev/null @@ -1,8 +0,0 @@ -import("system.vars"); -import("system.translate"); -import("system.result"); - -if (vars.get("$field.COMMRESTRICTIONS_ACTIVE").trim()) -{ // bug in SqlMaskingUtils.concat. -> use " " as seperator and replace " " by ", " - result.string(translate.text("No advertising by") + " " + ((vars.get("$field.COMMRESTRICTIONS_ACTIVE")).trim()).replace(/ +/g, ", ")); -} diff --git a/entity/Person_entity/entityfields/commrestrictions_active/valueProcess.js b/entity/Person_entity/entityfields/commrestrictions_active/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..eb0180412d1da157d1c0c7c2b6cc9de3818d508b --- /dev/null +++ b/entity/Person_entity/entityfields/commrestrictions_active/valueProcess.js @@ -0,0 +1,9 @@ +import("Contact_lib"); +import("system.neon"); +import("system.result"); +import("system.vars"); + +if (vars.get("$sys.viewmode") == neon.FRAME_VIEWMODE_DATASET) +{ + result.string(ContactUtils.getCommunicationRejectionSummary(vars.get("$field.CONTACTID"))); +} diff --git a/entity/Person_entity/recordcontainers/db/recordfieldmappings/commrestrictions_active.value/expression.js b/entity/Person_entity/recordcontainers/db/recordfieldmappings/commrestrictions_active.value/expression.js deleted file mode 100644 index 5c633cb5d6343c9ab5546304ab34410b8062adc5..0000000000000000000000000000000000000000 --- a/entity/Person_entity/recordcontainers/db/recordfieldmappings/commrestrictions_active.value/expression.js +++ /dev/null @@ -1,4 +0,0 @@ -import("Contact_lib"); -import("system.result"); - -result.string(ContactUtils.getActiveCommRestrictionsSubselect()); \ No newline at end of file diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index 0fc3fda74f9bba1c94802c0a14f18f289aa46955..18fb7588a420fcd0c5f890426d06f0d66033c85e 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -54,6 +54,10 @@ <key>The max participants count can not be equal or less then 0</key> <value>Die maximale Teilnehmerzahl muss größer 0 sein!</value> </entry> + <entry> + <key>No advertising</key> + <value>Keine Werbung</value> + </entry> <entry> <key>Value is too small, the minimum is %0</key> <value>Wert ist zu klein, das Minimum ist %0</value> diff --git a/process/Contact_lib/process.js b/process/Contact_lib/process.js index 261d7d63d48bc995c56d8eb58e42c0b2a962fd14..d154f286f514db3308097b02d05be777cedfe273 100644 --- a/process/Contact_lib/process.js +++ b/process/Contact_lib/process.js @@ -603,37 +603,41 @@ ContactUtils.hasCommRestriction = function(pContactId, pMedium, pStartDate) } /** - * returns a sql subselect which concatenates all commrestriction displayvalues (translated). - * The select needs the CONTACT.CONTACTID column. + * Generates a summary of communication settings with status 'rejected'. * - * @return {String} the resulting subselect + * @param {String} pContactId contactId of the contact for the communication settings + * @return {String} description of all rejected communication channels */ -ContactUtils.getActiveCommRestrictionsSubselect = function() +ContactUtils.getCommunicationRejectionSummary = function (pContactId) { - var mediumList = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.communicationMediumCampaign(), "COMMUNICATIONSETTINGS.MEDIUM"); - var mask = new SqlMaskingUtils() - - 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") + var mediumTitleSql = KeywordUtils.getResolvedTitleSqlPart($KeywordRegistry.communicationMediumCampaign(), "COMMUNICATIONSETTINGS.MEDIUM"); + var communicationRejections = newSelect(["CHANNEL_TYPE", "MEDIUM", mediumTitleSql]) + .from("COMMUNICATIONSETTINGS") + .where("COMMUNICATIONSETTINGS.CONTACT_ID", pContactId) + .and("COMMUNICATIONSETTINGS.CHANNEL_TYPE", $KeywordRegistry.communicationChannelType$profiling(), SqlBuilder.NOT_EQUAL()) + .and("COMMUNICATIONSETTINGS.STATUS", $KeywordRegistry.communicationSettingStatus$rejected()) + .orderBy(mediumTitleSql) + .table(); - var group = mask.getGroupConcat("DISTINCT "+mediumList, "', '"); - var subselect = "''"; - if(group) + if (communicationRejections.length > 0) { - var res = newSelect(group).from("COMMUNICATIONSETTINGS") - .where("COMMUNICATIONSETTINGS.CONTACT_ID = CONTACT.CONTACTID") - .and("COMMUNICATIONSETTINGS.STATUS", $KeywordRegistry.communicationSettingStatus$rejected()) - - var subres = newSelect(group).from("COMMUNICATIONSETTINGS") - .where("COMMUNICATIONSETTINGS.CONTACT_ID in ( "+orgContactSubselect.toString()+")") - .and("COMMUNICATIONSETTINGS.STATUS", $KeywordRegistry.communicationSettingStatus$rejected()) - - subselect = mask.concatWithSeparator(["("+res.toString()+")", "("+subres.toString()+")"], ", ", false); + var mediumTitles = []; + var hasGlobalRejection = communicationRejections.some(function ([channelType, medium, mediumTitle]) + { + if (channelType == $KeywordRegistry.communicationChannelType$address()) + { + mediumTitle = KeywordUtils.getViewValue($KeywordRegistry.communicationMediumCampaign(), $KeywordRegistry.communicationMediumCampaign$letter()); + } + mediumTitles.push(mediumTitle); + return channelType == $KeywordRegistry.communicationChannelType$global(); + }); + if (hasGlobalRejection) + { + return translate.text("No advertising"); + } + return translate.text("No advertising by") + " " + mediumTitles.join(", ") } - return subselect; + return ""; } /** diff --git a/process/Observation_lib/process.js b/process/Observation_lib/process.js index b2e80061c7b805fc9bcbfa405a8790c1bc257f5a..b67681a7849ecdad075089797c7084260d5934c7 100644 --- a/process/Observation_lib/process.js +++ b/process/Observation_lib/process.js @@ -637,22 +637,24 @@ Observation.actionState = function (pSelectedUIDs, pIsCancelAction) * If filter or entity are not set, they are set to an empty filter and the current entity. * * @param {String} [pEntity] - * @param {Object} [pFilter] + * @param {Object} [pFilterObj] * @return {Object} Object in Format: {"filter": {"type":"group","operator":"AND","childs":[...]}, "entity": "Entity_entity"} */ -Observation.getEntityFilter = function (pEntity, pFilter) +Observation.getEntityFilter = function (pEntity, pFilterObj) { if (!pEntity) pEntity = ContextUtils.getEntity(ContextUtils.getCurrentContextId()); - if (!pFilter) - pFilter = { + if (!pFilterObj) + { + pFilterObj = { "type":"group", "operator":"AND", "childs":[] - } + }; + } return JSON.stringify({ - "filter":pFilter, + "filter":pFilterObj, "entity":pEntity }); }