diff --git a/entity/Role_entity/recordcontainers/jdito/contentProcess.js b/entity/Role_entity/recordcontainers/jdito/contentProcess.js index 0f67d474c580225d5785b8ebfdde880267506a75..25ef04f7b115f5000691f3747eb8d9d4d0b269d0 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,