From 9b24039166e05c1acd8e272fdcb20ca1a0a3b0ed Mon Sep 17 00:00:00 2001 From: Benjamin Ulrich <b.ulrich@adito.de> Date: Tue, 2 Jun 2020 09:21:17 +0000 Subject: [PATCH] [Projekt: Entwicklung - Neon][TicketNr.: 1057726][Roles: Filter funktioniert nicht] --- .../recordcontainers/jdito/contentProcess.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/entity/Role_entity/recordcontainers/jdito/contentProcess.js b/entity/Role_entity/recordcontainers/jdito/contentProcess.js index 0f67d474c5..25ef04f7b1 100644 --- a/entity/Role_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Role_entity/recordcontainers/jdito/contentProcess.js @@ -1,3 +1,4 @@ +import("JditoFilter_lib"); import("Util_lib"); import("system.translate"); import("system.vars"); @@ -39,6 +40,31 @@ if (selectedRole != null) { }); } +var filter = vars.get("$local.filter"); + +//TODO: this is a workaround that filters the records manually, it should be possible to filter the users with a tools.* method +var filterFields = ["UID", "ROLENAME", "ROLETITLE", "ROLETYPE", "ROLEDESCRIPTION", "USERCOUNT", "IS_ASSIGNABLE"]; +var filterFns = { + "$$$LOOKUPFIELD$$$" : function (pRecordValue, pFilterValue, pOperator, pRow) + { + if (pOperator == "CONTAINS") + { + pRow = [pRow[1], pRow[3], pRow[4], pRow[5]]; + var filterValues = pFilterValue.split(" ").filter(function (val) {return val.trim();}); + return filterValues.every(function (filterValue) + { + return pRow.some(function (fieldValue) + { + return (new RegExp(filterValue, "i")).test(fieldValue); + }); + }); + } + return false; + } +}; +res = JditoFilterUtils.filterRecords(filterFields, res, filter.filter, filterFns); + + var order = vars.get("$local.order"); var columnOrder = { "ROLENAME.value" : 1, -- GitLab