diff --git a/entity/CommunicationSettings_entity/CommunicationSettings_entity.aod b/entity/CommunicationSettings_entity/CommunicationSettings_entity.aod index bfa47c0a1f10110663a51a99eca52076da1d9573..eb42697bc6b3d0461535d6cf2386076ff3331ec2 100644 --- a/entity/CommunicationSettings_entity/CommunicationSettings_entity.aod +++ b/entity/CommunicationSettings_entity/CommunicationSettings_entity.aod @@ -4,6 +4,7 @@ <title>Communication Settings</title> <majorModelMode>DISTRIBUTED</majorModelMode> <contentTitleProcess>%aditoprj%/entity/CommunicationSettings_entity/contentTitleProcess.js</contentTitleProcess> + <onValidation>%aditoprj%/entity/CommunicationSettings_entity/onValidation.js</onValidation> <iconIdProcess>%aditoprj%/entity/CommunicationSettings_entity/iconIdProcess.js</iconIdProcess> <titlePlural>Communication Settings</titlePlural> <recordContainer>db</recordContainer> @@ -209,12 +210,17 @@ <name>VERSION</name> <valueProcess>%aditoprj%/entity/CommunicationSettings_entity/entityfields/version/valueProcess.js</valueProcess> </entityField> + <entityField> + <name>overrideInfo</name> + <valueProcess>%aditoprj%/entity/CommunicationSettings_entity/entityfields/overrideinfo/valueProcess.js</valueProcess> + </entityField> </entityFields> <recordContainers> <dbRecordContainer> <name>db</name> <fromClauseProcess>%aditoprj%/entity/CommunicationSettings_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess> <conditionProcess>%aditoprj%/entity/CommunicationSettings_entity/recordcontainers/db/conditionProcess.js</conditionProcess> + <orderClauseProcess>%aditoprj%/entity/CommunicationSettings_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> <alias>Data_alias</alias> <recordFieldMappings> <dbRecordFieldMapping> @@ -247,6 +253,7 @@ <dbRecordFieldMapping> <name>CHANNEL_TYPE.displayValue</name> <expression>%aditoprj%/entity/CommunicationSettings_entity/recordcontainers/db/recordfieldmappings/channel_type.displayvalue/expression.js</expression> + <columnAlias>channelTypeName</columnAlias> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>MEDIUM.displayValue</name> diff --git a/entity/CommunicationSettings_entity/entityfields/overrideinfo/valueProcess.js b/entity/CommunicationSettings_entity/entityfields/overrideinfo/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..be189450db2f690b7f43814a0cf1537bfee929f8 --- /dev/null +++ b/entity/CommunicationSettings_entity/entityfields/overrideinfo/valueProcess.js @@ -0,0 +1,40 @@ +import("Keyword_lib"); +import("KeywordRegistry_basic"); +import("system.translate"); +import("system.result"); +import("system.vars"); +import("Sql_lib"); +import("MarketingCondition_lib"); + +var channelType = vars.get("$field.CHANNEL_TYPE"); +if (channelType == $KeywordRegistry.communicationChannelType$communication() || channelType == $KeywordRegistry.communicationChannelType$address()) +{ + var channelIdSql = "'" + vars.get("$field.CHANNEL_ID") + "'"; + + var superSettingCondition = new CommunicationSettingsCondition() + .contactId(vars.get("$field.CONTACT_ID")) + .rejected(); + + if (channelType == $KeywordRegistry.communicationChannelType$communication()) + { + superSettingCondition.medium(vars.get("$field.MEDIUM"), channelIdSql); + } + else if (channelType == $KeywordRegistry.communicationChannelType$address()) + { + superSettingCondition.address(channelIdSql); + } + + var [superSettingId, superSettingChannelType, superSettingMedium, superSettingStatus] = superSettingCondition + .buildSelect(["COMMUNICATIONSETTINGSID", "CHANNEL_TYPE", "MEDIUM", "STATUS"]) + .orderBy("CHANNEL_TYPE") + .arrayRow(); + + if (superSettingId && superSettingId != vars.get("$field.COMMUNICATIONSETTINGSID") && superSettingStatus != vars.get("$field.STATUS")) + { + var channelName = superSettingMedium + ? KeywordUtils.getViewValue($KeywordRegistry.communicationMediumCampaign(), superSettingMedium) + : KeywordUtils.getViewValue($KeywordRegistry.communicationChannelType(), superSettingChannelType); + var settingTitle = channelName + " - " + KeywordUtils.getViewValue($KeywordRegistry.communicationSettingStatus(), superSettingStatus); + result.string(translate.withArguments("This setting is overridden by the setting '%0'", [settingTitle])); + } +} \ No newline at end of file diff --git a/entity/CommunicationSettings_entity/onValidation.js b/entity/CommunicationSettings_entity/onValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..9641a12f5a4edec9e96b0f93da73cef3a1411947 --- /dev/null +++ b/entity/CommunicationSettings_entity/onValidation.js @@ -0,0 +1,38 @@ +import("system.translate"); +import("system.result"); +import("system.vars"); +import("Sql_lib"); + +var channelType = vars.get("$field.CHANNEL_TYPE"); +var medium = vars.get("$field.MEDIUM"); +var channelId = vars.get("$field.CHANNEL_ID"); + +var alreadyExistsQuery = new SqlBuilder() + .selectCount() + .from("COMMUNICATIONSETTINGS") + .where("COMMUNICATIONSETTINGS.CONTACT_ID", vars.get("$field.CONTACT_ID")) + .and("COMMUNICATIONSETTINGS.COMMUNICATIONSETTINGSID", vars.get("$field.COMMUNICATIONSETTINGSID"), SqlBuilder.NOT_EQUAL()) + .and("COMMUNICATIONSETTINGS.CHANNEL_TYPE", channelType); + +if (medium) +{ + alreadyExistsQuery.and("COMMUNICATIONSETTINGS.MEDIUM", medium); +} +else +{ + alreadyExistsQuery.and("COMMUNICATIONSETTINGS.MEDIUM is null"); +} + +if (channelId) +{ + alreadyExistsQuery.and("COMMUNICATIONSETTINGS.CHANNEL_ID", channelId); +} +else +{ + alreadyExistsQuery.and("COMMUNICATIONSETTINGS.CHANNEL_ID is null"); +} + +if (alreadyExistsQuery.cell() > 0) +{ + result.string(translate.text("A communication setting for this channel already exists!")); +} \ No newline at end of file diff --git a/entity/CommunicationSettings_entity/recordcontainers/db/orderClauseProcess.js b/entity/CommunicationSettings_entity/recordcontainers/db/orderClauseProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..88d3371b95e19c0fa35060fe9cf63968b9494b8a --- /dev/null +++ b/entity/CommunicationSettings_entity/recordcontainers/db/orderClauseProcess.js @@ -0,0 +1,8 @@ +import("system.db"); +import("system.result"); + +result.object({ + "channelTypeName": db.ASCENDING, + "MEDIUM": db.ASCENDING, + "CHANNEL_ID": db.ASCENDING +}); \ No newline at end of file diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index d625a68e370e400d274fbfb3c438cd766ac1715e..39e75b0b8b5a297cd004d35fe7450ad6f9c8b702 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -8539,6 +8539,30 @@ <entry> <key>Auto probability</key> </entry> + <entry> + <key>Done by</key> + </entry> + <entry> + <key>Done on</key> + </entry> + <entry> + <key>First customer conversation</key> + </entry> + <entry> + <key>Further customer meetings</key> + </entry> + <entry> + <key>Post office box number</key> + </entry> + <entry> + <key>Project team</key> + </entry> + <entry> + <key>Prioritization based on segmentation parameters</key> + </entry> + <entry> + <key>Source / origin of the generation of contacts</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> <sqlModels> diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index 4152b5d25dac2a2f3cac4f0f9b96ab9136170795..9b42ae27aa1608306f18d0277003ce9fb5547feb 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -38,6 +38,10 @@ <key>%0 out of %1 records were changed to \"%2\".\n %3 record/s could not be updated.</key> <value>%0 von %1 Datensätze wurden auf \"%2\" geändert.\n%3 Datensätze konnten nicht akutualisiert werden.</value> </entry> + <entry> + <key>This setting is overridden by the setting '%0'</key> + <value>Diese Einstellung wird durch die Einstellung '%0' überschrieben</value> + </entry> <entry> <key>Value is too big, the maximum is %0</key> <value>Wert ist zu groß, das Maximum ist %0</value> @@ -10269,6 +10273,10 @@ Bitte Datumseingabe prüfen</value> <key>entity</key> <value>Entität</value> </entry> + <entry> + <key>A communication setting for this channel already exists!</key> + <value>Für diesen Kanal gibt es bereits eine Werbeeinstellung!</value> + </entry> <entry> <key>Zeigt wie viele Vertriebsprojekte in den einzelnen Vertriebsphasen sind. </key> </entry> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index 27f7a19d55db8ec35573dc869a0c11428a969c58..610381d7366efaaae1e4b6da15c6d6e9b09e889f 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -8624,6 +8624,30 @@ <entry> <key>Auto probability</key> </entry> + <entry> + <key>Done by</key> + </entry> + <entry> + <key>Done on</key> + </entry> + <entry> + <key>First customer conversation</key> + </entry> + <entry> + <key>Further customer meetings</key> + </entry> + <entry> + <key>Post office box number</key> + </entry> + <entry> + <key>Project team</key> + </entry> + <entry> + <key>Prioritization based on segmentation parameters</key> + </entry> + <entry> + <key>Source / origin of the generation of contacts</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/neonView/CommunicationSettingsPreview_view/CommunicationSettingsPreview_view.aod b/neonView/CommunicationSettingsPreview_view/CommunicationSettingsPreview_view.aod index 8551f448c5fb966fd25c9bfb2ac700f35d584eac..80f84884292be22e8b9ac4ff85599d312047f574 100644 --- a/neonView/CommunicationSettingsPreview_view/CommunicationSettingsPreview_view.aod +++ b/neonView/CommunicationSettingsPreview_view/CommunicationSettingsPreview_view.aod @@ -15,6 +15,7 @@ <titleField>#CONTENTTITLE</titleField> <subtitleField>STATUS</subtitleField> <isEditable v="false" /> + <informationField>overrideInfo</informationField> </cardViewTemplate> <genericViewTemplate> <name>Infos</name> diff --git a/process/MarketingCondition_lib/process.js b/process/MarketingCondition_lib/process.js index 2053acd67b4992dadcbb7c8048dbd530d4e80b3b..0be87176637e8c271b50db9acd920d1879a8afd8 100644 --- a/process/MarketingCondition_lib/process.js +++ b/process/MarketingCondition_lib/process.js @@ -10,6 +10,7 @@ import("KeywordRegistry_basic"); function CommunicationSettingsCondition () { this._contactIdSql = "CONTACT.CONTACTID"; + this._contactId = null; this._channelType = null; this._medium = null; this._channelIdSql = null; @@ -20,6 +21,14 @@ function CommunicationSettingsCondition () CommunicationSettingsCondition.prototype.contactIdField = function (pContactIdSql) { this._contactIdSql = pContactIdSql; + this._contactId = null; + return this; +} + +CommunicationSettingsCondition.prototype.contactId = function (pContactId) +{ + this._contactId = pContactId; + this._contactIdSql = null; return this; } @@ -120,8 +129,16 @@ CommunicationSettingsCondition.prototype.buildSelect = function (pSelectFields) pSelectFields = "COMMUNICATIONSETTINGS.COMMUNICATIONSETTINGSID"; var sql = newSelect(pSelectFields) .from("COMMUNICATIONSETTINGS") - .where("COMMUNICATIONSETTINGS.CONTACT_ID = " + this._contactIdSql) - .andIfSet("COMMUNICATIONSETTINGS.STATUS", this._settingStatus); + .whereIfSet("COMMUNICATIONSETTINGS.STATUS", this._settingStatus); + + if (this._contactIdSql) + { + sql.and("COMMUNICATIONSETTINGS.CONTACT_ID = " + this._contactIdSql) + } + else if (this._contactId) + { + sql.and("COMMUNICATIONSETTINGS.CONTACT_ID", this._contactId); + } var channelCondition = newWhere("COMMUNICATIONSETTINGS.CHANNEL_TYPE", $KeywordRegistry.communicationChannelType$global()); if (this._channelType)