diff --git a/aliasDefinition/Data_alias/Data_alias.aod b/aliasDefinition/Data_alias/Data_alias.aod index 81b8e1987ede5b81ebbeea7f26683686a47b1585..151d58ab28c98bf8354274a67407a0345d545a3b 100644 --- a/aliasDefinition/Data_alias/Data_alias.aod +++ b/aliasDefinition/Data_alias/Data_alias.aod @@ -253,6 +253,11 @@ <global v="false" /> <property v="true" /> </customBooleanProperty> + <customJDitoProperty> + <name>translate4Log</name> + <global v="false" /> + <property>%aditoprj%/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/contact/entityfields/language/customproperties/translate4log/property.js</property> + </customJDitoProperty> </customProperties> </entityFieldDb> <entityFieldDb> @@ -8055,13 +8060,6 @@ <documentation></documentation> <title>Tablename</title> <description></description> - <customProperties> - <customBooleanProperty> - <name>log</name> - <global v="false" /> - <property v="true" /> - </customBooleanProperty> - </customProperties> </entityFieldDb> <entityFieldDb> <name>DATE_EDIT</name> @@ -8076,12 +8074,6 @@ <documentation></documentation> <title>Modification date</title> <description></description> - <customProperties> - <customBooleanProperty> - <name>log</name> - <global v="false" /> - </customBooleanProperty> - </customProperties> </entityFieldDb> <entityFieldDb> <name>DESCRIPTION</name> @@ -8096,13 +8088,6 @@ <documentation></documentation> <title>Description</title> <description></description> - <customProperties> - <customBooleanProperty> - <name>log</name> - <global v="false" /> - <property v="true" /> - </customBooleanProperty> - </customProperties> </entityFieldDb> <entityFieldDb> <name>SOURCE_TABLENAMEID</name> @@ -8117,13 +8102,6 @@ <documentation></documentation> <title>Source tablename Id</title> <description></description> - <customProperties> - <customBooleanProperty> - <name>log</name> - <global v="false" /> - <property v="true" /> - </customBooleanProperty> - </customProperties> </entityFieldDb> <entityFieldDb> <name>LOGTYPE</name> @@ -8138,13 +8116,6 @@ <documentation></documentation> <title>Log type</title> <description></description> - <customProperties> - <customBooleanProperty> - <name>log</name> - <global v="false" /> - <property v="true" /> - </customBooleanProperty> - </customProperties> </entityFieldDb> <entityFieldDb> <name>SOURCE_TABLENAME</name> @@ -8159,13 +8130,6 @@ <documentation></documentation> <title>Source tablename</title> <description></description> - <customProperties> - <customBooleanProperty> - <name>log</name> - <global v="false" /> - <property v="true" /> - </customBooleanProperty> - </customProperties> </entityFieldDb> <entityFieldDb> <name>AB_LOGHISTORYID</name> @@ -8194,13 +8158,6 @@ <documentation></documentation> <title>Tablename Id</title> <description></description> - <customProperties> - <customBooleanProperty> - <name>log</name> - <global v="false" /> - <property v="true" /> - </customBooleanProperty> - </customProperties> </entityFieldDb> <entityFieldDb> <name>DATE_NEW</name> @@ -8215,12 +8172,6 @@ <documentation></documentation> <title>Creation date</title> <description></description> - <customProperties> - <customBooleanProperty> - <name>log</name> - <global v="false" /> - </customBooleanProperty> - </customProperties> </entityFieldDb> <entityFieldDb> <name>USER_NEW</name> diff --git a/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/contact/entityfields/language/customproperties/translate4log/property.js b/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/contact/entityfields/language/customproperties/translate4log/property.js new file mode 100644 index 0000000000000000000000000000000000000000..51a8cec57a7a635681f7c183f2fe3c369db8f692 --- /dev/null +++ b/aliasDefinition/Data_alias/aliasdefinitionsub/entitygroup/entities/contact/entityfields/language/customproperties/translate4log/property.js @@ -0,0 +1,7 @@ +import("system.result"); +import("Loghistory_lib"); +import("Keyword_lib"); + +var params = Translate4LogParams.load(); +var res = LanguageKeywordUtils.getViewValue(params.value, params.locale); +result.string(res); \ No newline at end of file diff --git a/process/Keyword_lib/process.js b/process/Keyword_lib/process.js index 2403beea8814764f501c69e679e4d0e419c1baa0..1b01908232f309424584197b5554fcb6aa8538c8 100644 --- a/process/Keyword_lib/process.js +++ b/process/Keyword_lib/process.js @@ -295,11 +295,12 @@ LanguageKeywordUtils.getResolvedTitleSqlPart = function(pDbFieldName, pLocale) * returns a specific name (translated) - this is normally the view-value of a language * * @param {String} key id value of the language where the view-value shall be searched + * @param {String} [locale] Language-value for translations * * @return {String} representation of the translated name * */ -LanguageKeywordUtils.getViewValue = function(key) +LanguageKeywordUtils.getViewValue = function(key, locale) { if (!key) return ""; @@ -310,7 +311,7 @@ LanguageKeywordUtils.getViewValue = function(key) var originalTitle = db.cell(sql); if (originalTitle == "") return ""; - var translatedTitle = translate.text(originalTitle); + var translatedTitle = locale ? translate.text(originalTitle, locale) : translate.text(originalTitle); return translatedTitle; }; diff --git a/process/Loghistory_lib/process.js b/process/Loghistory_lib/process.js index 396fb3eb19bda0b885ff45741d727ccb831aeacb..ee9fda09a9c8299c1c0d25ee907fdd32e35319db 100644 --- a/process/Loghistory_lib/process.js +++ b/process/Loghistory_lib/process.js @@ -1,3 +1,4 @@ +import("system.vars"); import("system.util"); import("system.logging"); import("system.project"); @@ -334,14 +335,8 @@ LogHistoryExecutor.prototype._getFormattedValue = function (pDescription, pValue } else if (pDescription.translate4Log != null && pDescription.translate4Log != "") { - var params = { - rowId: this.idValue, - value: pValue.toString(), - action: this.sqlAction, - locale: this.translationLanguage - }; - - pValue = process.executeScript("LogHistoryExecutor._getFormattedValue ", pDescription.translate4Log, params); + var params = Translate4LogParams.generateParams(this.idValue, pValue.toString(), this.sqlAction, this.translationLanguage); + pValue = process.executeScript("LogHistoryExecutor._getFormattedValue ", pDescription.translate4Log, params, vars.get("$sys.dbalias")); } else if (pDescription.columnType == String(SQLTYPES.TIMESTAMP)) pValue = datetime.toDate(pValue, translate.text("dd.MM.yyyy", this.translationLanguage), "Europe/Berlin");//TODO: timezone? @@ -367,4 +362,54 @@ LogHistoryExecutor.prototype._getFormattedValue = function (pDescription, pValue } } return pValue; -} \ No newline at end of file +} + + +/** + * object for easier handling of the parameters that are provided within the translate4Log-process for auditing + * + * @example + * import("system.result"); + * import("Loghistory_lib"); + * import("Keyword_lib"); + * + * var params = Translate4LogParams.load(); + * var res = LanguageKeywordUtils.getViewValue(params.value, params.locale); + * result.string(res); + * @class + */ +function Translate4LogParams() +{ + //watch out the Translate4LogParams.generateParams function + this.rowId = vars.get("$local.rowId"); + this.value = vars.get("$local.value"); + this.action = vars.get("$local.action"); + this.locale = vars.get("$local.locale"); +} + + +/** + * function for generating the parameters which can be passed to another process + * the parameters should be self explaing since every single of them is a parametervalue that will be passed to anotherProcess + * + * @static + */ +Translate4LogParams.generateParams = function (pRowId, pValue, pAction, pLocale) +{ + //watch out the Translate4LogParams-constructor function + var res = { + rowId: pRowId, + value: pValue, + action: pAction, + locale: pLocale + }; + return res;//store in variable for autocomplete of the ADITO designer +}; + +/** + * creates an instnace of Translate4LogParams and loads the data + */ +Translate4LogParams.load = function() +{ + return new Translate4LogParams(); +}; \ No newline at end of file