diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index 151d58ab28c98bf8354274a67407a0345d545a3b..61811a2b9a36b4cb621761f4b9e2e284abf0ecfa 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -972,6 +972,11 @@ <global v="false" /> <property v="true" /> </customBooleanProperty> + <customJDitoProperty> + <name>translate4Log</name> + <global v="false" /> + <property>%aditoprj%/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/address/entityfields/country/customproperties/translate4log/property.js</property> + </customJDitoProperty> </customProperties> </entityFieldDb> <entityFieldDb> diff --git a/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/address/entityfields/country/customproperties/translate4log/property.js b/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/address/entityfields/country/customproperties/translate4log/property.js new file mode 100644 index 0000000000000000000000000000000000000000..3951889f460b2c87e5a592e7241d8aa1e2656033 --- /dev/null +++ b/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/address/entityfields/country/customproperties/translate4log/property.js @@ -0,0 +1,7 @@ +import("system.result"); +import("Country_lib"); +import("Loghistory_lib"); + +var params = Translate4LogParams.load(); +var countryName = CountryUtils.getLatinNameByIso2(params.value, params.locale); +result.string(countryName); \ No newline at end of file diff --git a/entity/Address_entity/entityfields/country/displayValueProcess.js b/entity/Address_entity/entityfields/country/displayValueProcess.js index 22c043fdc3d9ab8fbe1e9b67738a0f105ce7aaee..3eb96b525814164e667c8f223eea3be8de1da0ec 100644 --- a/entity/Address_entity/entityfields/country/displayValueProcess.js +++ b/entity/Address_entity/entityfields/country/displayValueProcess.js @@ -1,11 +1,8 @@ import("system.vars"); -import("system.db"); -import("system.translate"); import("system.result"); -import("Sql_lib"); +import("Country_lib"); //TODO: temporary testing code -> will be replaced with title-mechanic var isoCode = vars.get("$field.COUNTRY"); -var countryName = db.cell(SqlCondition.begin().andPrepare("AB_COUNTRYINFO.ISO2", isoCode).buildSql("select AB_COUNTRYINFO.NAME_LATIN from AB_COUNTRYINFO")); -countryName = translate.text(countryName); +var countryName = CountryUtils.getLatinNameByIso2(isoCode); result.string(countryName); \ No newline at end of file diff --git a/process/Country_lib/Country_lib.aod b/process/Country_lib/Country_lib.aod new file mode 100644 index 0000000000000000000000000000000000000000..7097e51847d7c7bb604c4435f916620d3a2ccf04 --- /dev/null +++ b/process/Country_lib/Country_lib.aod @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<process xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.2.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.1"> + <name>Country_lib</name> + <majorModelMode>DISTRIBUTED</majorModelMode> + <process>%aditoprj%/process/Country_lib/process.js</process> + <variants> + <element>LIBRARY</element> + </variants> +</process> diff --git a/process/Country_lib/process.js b/process/Country_lib/process.js new file mode 100644 index 0000000000000000000000000000000000000000..67f674c97d8e655ddf53b3ecdf639d6a2dbf4892 --- /dev/null +++ b/process/Country_lib/process.js @@ -0,0 +1,30 @@ +import("system.db"); +import("system.translate"); +import("Sql_lib"); + +/** + * provides functions for miscellaneous interactions with countrydata + * Do not create an instance of this! + * + * @class + * @static + */ +function CountryUtils() {} + +/** +* loads the translated latin name of an entry within the countryinfos by a provided ISO2-code +* +* @param {String} pIso2 the uppercase ISO2 code whoes latin name shall be retriefed, e.g."DE" +* @param {String} [pLocale=current client/server language] specifies the locale for translating +* +* @return {String} the translated country name in the latin version +* +*/ +CountryUtils.getLatinNameByIso2 = function(pIso2, pLocale) +{ + var countryName = db.cell(SqlCondition.begin() + .andPrepare("AB_COUNTRYINFO.ISO2", pIso2) + .buildSql("select AB_COUNTRYINFO.NAME_LATIN from AB_COUNTRYINFO")); + countryName = pLocale ? translate.text(countryName, pLocale) : translate.text(countryName); + return countryName; +}; \ No newline at end of file diff --git a/process/Loghistory_lib/process.js b/process/Loghistory_lib/process.js index ee9fda09a9c8299c1c0d25ee907fdd32e35319db..6e2c4507661c1eb79947b74a4a8b6f0ce5a3ec03 100644 --- a/process/Loghistory_lib/process.js +++ b/process/Loghistory_lib/process.js @@ -79,11 +79,11 @@ LogHistoryExecutor.prototype.execute = function () columnStructure = structure.tables[this.affectedTable].columns; for (var column in columnStructure) { - if (columnStructure[column].tableRef) references[column] = - { - table: columnStructure[column].tableRef, - id: "" - } + if (columnStructure[column].tableRef) + references[column] = { + table: columnStructure[column].tableRef, + id: "" + }; if (columnStructure[column].primaryKey) primaryKey = column; if (columnStructure[column].log)