Something went wrong on our end
-
Johannes Goderbauer authored
[Projekt: Entwicklung - Neon][TicketNr.: 1065331][Fehlende Aktionen bei der Tabelle Projektteam im Vertriebsprojekt]
Johannes Goderbauer authored[Projekt: Entwicklung - Neon][TicketNr.: 1065331][Fehlende Aktionen bei der Tabelle Projektteam im Vertriebsprojekt]
contentProcess.js 5.01 KiB
import("system.translate");
import("system.result");
import("system.vars");
import("system.entities");
import("KeywordRegistry_basic");
import("Sql_lib");
var idValues = vars.get("$local.idvalues");
var filter = vars.get("$local.filter");
var memberLoadingConfig = entities.createConfigForLoadingRows()
.entity("Member_entity")
.provider("Links")
.addParameter("ObjectRowId_param", vars.get("$param.ObjectRowId_param"))
.addParameter("ObjectType_param", vars.get("$param.ObjectType_param"))
.fields(["#UID", "CONTACT_ID", "CONTACT_ID.displayValue", "CONTACTROLE", "DEPARTMENT", "ICON", "IMAGE",
"MEMBERROLE", "MEMBERROLE.displayValue", "OBJECT_ROWID", "OBJECT_TYPE",
"OBJECTMEMBERID", "ORG_ORGID", "ORGANISATION_NAME", "PERSON_FIRSTNAME", "PERSON_FULL_NAME",
"PERSON_LASTNAME", "PERSON_PERSID", "PERSON_SALUTATION", "PERSON_TITLE", "POSITION", "TARGETCONTEXT",
"recordType"]);
if (idValues)
{
memberLoadingConfig.uids(idValues);
}
if (filter && filter.filter != null)
{
memberLoadingConfig.filter(JSON.stringify(filter.filter));
}
var memberRows = entities.getRows(memberLoadingConfig);
if (vars.get("$param.ObjectType_param") == "Salesproject" && vars.get("$param.ObjectRowId_param") != null)
{
var orgContactId = newSelect("SALESPROJECT.CONTACT_ID")
.from("SALESPROJECT")
.where("SALESPROJECT.SALESPROJECTID", "$param.ObjectRowId_param")
.cell();
var districtLoadingConfig = entities.createConfigForLoadingRows()
.entity("DistrictResponsible_entity")
.provider("OrganisationResponsibles")
.addParameter("OrgUid_param", orgContactId)
.fields(["#UID","DISTRICTRESPONSIBLEID", "DISTRICT_ID", "EMPLOYEE_CONTACT_ID",
"EMPLOYEE_CONTACT_ID.displayValue", "USER_EDIT", "USER_NEW",
"departmentAttributeName", "DATE_EDIT", "DATE_NEW"]);
var districtRows = entities.getRows(districtLoadingConfig);
districtRows = districtRows.map(function(row)
{
return [row["#UID"], row["DISTRICTRESPONSIBLEID"], row["DISTRICT_ID"], row["EMPLOYEE_CONTACT_ID"], row["EMPLOYEE_CONTACT_ID.displayValue"],
row["USER_EDIT"], row["USER_NEW"], row["departmentAttributeName"], row["DATE_EDIT"], row["DATE_NEW"]];
});
}
memberRows = memberRows.map(function(row)
{
return [row["#UID"], row["OBJECTMEMBERID"], row["CONTACT_ID"], row["CONTACT_ID.displayValue"], row["CONTACTROLE"], row["DEPARTMENT"], row["ICON"],
row["IMAGE"], row["MEMBERROLE"], row["MEMBERROLE.displayValue"], row["OBJECT_ROWID"],
row["OBJECT_TYPE"], row["ORG_ORGID"], row["ORGANISATION_NAME"], row["PERSON_FIRSTNAME"],
row["PERSON_FULL_NAME"], row["PERSON_LASTNAME"], row["PERSON_PERSID"], row["PERSON_SALUTATION"], row["PERSON_TITLE"],
row["POSITION"], row["TARGETCONTEXT"], row["recordType"]];
});
var responsibleUids = [];
districtRows.forEach(function(row){
responsibleUids.push(row[3]);
});
var loadingConfPers = entities.createConfigForLoadingRows()
.entity("Person_entity")
.uids(responsibleUids)
.fields(["ORGANISATION_ID", "ORGANISATION_NAME", "CONTACTROLE", "POSITION",
"FIRSTNAME", "LASTNAME", "SALUTATION", "TITLE"]);
var persRows = entities.getRows(loadingConfPers);
persRows = persRows.map(function(row){
return [row["SALUTATION"], row["TITLE"], row["FIRSTNAME"], row["LASTNAME"],
row["ORGANISATION_NAME"], row["ORGANISATION_ID"], row["CONTACTROLE"],
row["POSITION"], row["PERSONID"]];
});
districtRows.forEach(function(row, counter){
memberRows.push(
[row[0],
null,
row[3],
row[4],
persRows[counter][6],
row[7],
"VAADIN:GLOBE",
"TEXT:" + row[4].substring(row[4].indexOf(" ", 0)+1, row[4].length),
"MEMBERROLEDISTRICTRESPONSIBLE",
translate.text("District Responsible"),
vars.get("$param.ObjectRowId_param"),
vars.get("$param.ObjectType_param"),
persRows[counter][5],
persRows[counter][4],
persRows[counter][2],
row[4],
persRows[counter][3],
persRows[counter][8],
persRows[counter][0],
persRows[counter][1],
persRows[counter][7],
null,
"DistrictResponsible"
]);
});
result.object(memberRows);