Skip to content
Snippets Groups Projects
Commit 5a04d22c authored by Johannes Goderbauer's avatar Johannes Goderbauer
Browse files

Merge branch '#1065815-FixEmployeeRole' into '2020.2.0'

#1065815#1066095-FixEmployeeRole Fix Fehler beim öffnen der Preview

See merge request xrm/basic!419
parents ae5190ad 5dbc08aa
No related branches found
No related tags found
No related merge requests found
import("Employee_lib");
import("system.neon");
import("system.tools");
import("system.vars");
import("system.result");
var userTitle = vars.exists("$param.UserTitle_param") && vars.get("$param.UserTitle_param");
var excludeRolesArray = ["INTERNAL_EVERYONE", "INTERNAL_GROUPWARE", "INTERNAL_SNMP", "INTERNAL_DESIGNER", "INTERNAL_TECHNICAL"];
var excludeRolesArray = EmployeeRole.getExcludeRoles();
for each (let role in tools.getAllRoles()) {
if (!role[4]) {
excludeRolesArray.push(role[3]);
}
}
if(vars.get("$sys.recordstate") != neon.OPERATINGSTATE_NEW && userTitle)
excludeRolesArray = excludeRolesArray.concat(tools.getRoles(userTitle));
......
import("Employee_lib");
import("Util_lib");
import("system.result");
import("system.vars");
......@@ -6,6 +7,8 @@ import("system.tools");
var roles = [];
var userTitle = vars.exists("$param.UserTitle_param") && vars.get("$param.UserTitle_param");
var allRoles = tools.getAllRoles();
let exclude = EmployeeRole.getExcludeRoles();
if (userTitle && tools.existUsers(userTitle))
{
......@@ -14,11 +17,14 @@ if (userTitle && tools.existUsers(userTitle))
{
if (!this[role] && role != "INTERNAL_EVERYONE")
{
let context = "Role"
var roleTitle = role;
if (role in allRoles)
roleTitle = allRoles[role][0];
if (exclude.indexOf("role") > -1)
context = "";
roles.push([role, role, roleTitle, "Role"]);
roles.push([role, role, roleTitle, context]);
this[role] = true;
}
}, existsObj);
......
......@@ -166,4 +166,22 @@ EmployeeUtils.getUsersDepartment = function(pContactId, pDepartmentAsDisplayable
}
return department;
}
/**
* Provides functions for employeesrole
*
* Do not create an instance of this!
*
* @class
*/
function EmployeeRole () {}
/**
* Provides the excludeed Roles of the Employee
* @return Array the Roles
*/
EmployeeRole.getExcludeRoles = function ()
{
return ["INTERNAL_EVERYONE", "INTERNAL_GROUPWARE", "INTERNAL_SNMP", "INTERNAL_DESIGNER", "INTERNAL_TECHNICAL"];
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment