From 49346bd8f5b667b31e36b69cbe9fe4f76c47102b Mon Sep 17 00:00:00 2001 From: Johannes Hoermann <j.hoermann@adito.de> Date: Tue, 10 Sep 2019 09:54:58 +0200 Subject: [PATCH] fix employee as attribute selection --- entity/Employee_entity/Employee_entity.aod | 6 ++++++ .../recordcontainers/jdito/contentProcess.js | 1 + process/Attribute_lib/process.js | 8 ++++++++ process/Employee_lib/process.js | 5 +++++ 4 files changed, 20 insertions(+) diff --git a/entity/Employee_entity/Employee_entity.aod b/entity/Employee_entity/Employee_entity.aod index eae6cd44e8..d16972d68d 100644 --- a/entity/Employee_entity/Employee_entity.aod +++ b/entity/Employee_entity/Employee_entity.aod @@ -306,6 +306,9 @@ </entityParameter> </children> </entityConsumer> + <entityField> + <name>SHORT_UID</name> + </entityField> </entityFields> <recordContainers> <jDitoRecordContainer> @@ -366,6 +369,9 @@ <name>ROLE_FILTER.value</name> <isFilterable v="true" /> </jDitoRecordFieldMapping> + <jDitoRecordFieldMapping> + <name>SHORT_UID.value</name> + </jDitoRecordFieldMapping> </recordFieldMappings> <filterExtensions> <filterExtension> diff --git a/entity/Employee_entity/recordcontainers/jdito/contentProcess.js b/entity/Employee_entity/recordcontainers/jdito/contentProcess.js index 870d945fe5..4d17f73bab 100644 --- a/entity/Employee_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Employee_entity/recordcontainers/jdito/contentProcess.js @@ -92,6 +92,7 @@ for (let i = 0, l = users.length; i < l; i++) { users[i][9] = nameMap[users[i][8]] || ""; users[i][12] = ""; + users[i][13] = EmployeeUtils.sliceUserId(users[i][0]); } var order = vars.get("$local.order"); diff --git a/process/Attribute_lib/process.js b/process/Attribute_lib/process.js index bf1f322fba..9afb0bf19c 100644 --- a/process/Attribute_lib/process.js +++ b/process/Attribute_lib/process.js @@ -1,3 +1,4 @@ +import("Employee_lib"); import("KeywordData_lib"); import("Context_lib"); import("system.util"); @@ -158,6 +159,9 @@ AttributeUtil.getPossibleListValues = function (pAttributeId, pAttributeType, pI if (module) { var uid = "#UID"; + if (module == "Employee_entity") + uid = "SHORT_UID"; + var title = "#CONTENTTITLE"; var config = entities.createConfigForLoadingRows() .entity(module) @@ -782,6 +786,9 @@ $AttributeTypes.OBJECTSELECTION = { { if (pValue) { + if (pModule == "Employee_entity") + pValue = EmployeeUtils.prefixUserId(pValue); + var title = "#CONTENTTITLE"; var config = entities.createConfigForLoadingRows() .entity(pModule) @@ -794,6 +801,7 @@ $AttributeTypes.OBJECTSELECTION = { }, getDropDownDefinitions : function () { + // TODO: use loadEntity from context_entity var dropDownList = []; project.getDataModels(project.DATAMODEL_KIND_ENTITY).forEach( function (entity) diff --git a/process/Employee_lib/process.js b/process/Employee_lib/process.js index 8b2729142c..3702cc9561 100644 --- a/process/Employee_lib/process.js +++ b/process/Employee_lib/process.js @@ -49,6 +49,11 @@ EmployeeUtils.sliceUserId = function (pUserId) return pUserId.slice(-36); } +EmployeeUtils.prefixUserId = function (pUserId) +{ + return "_____USER_" + pUserId; +} + /** * generates a username from the firstname and lastname with the given structure * -- GitLab