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

Merge branch '1061095_FixActivityIcons' into '2020.2.0'

[Projekt: Entwicklung - Neon][TicketNr.: 1061095][Aktivität - Registerreiter...

See merge request xrm/basic!361
parents 9deb1758 e8a40f94
No related branches found
No related tags found
No related merge requests found
import("system.entities");
import("Keyword_lib");
import("KeywordRegistry_basic");
import("system.vars");
import("Sql_lib")
......@@ -99,12 +101,22 @@ function queryChildrenElements (pContextName, pID) {
* @param pGetFirst start from the first element
*/
function queryRootElement (pContextName, pID, pGetFirst) {
var resultArray;
var resultArray, rowValues, conf, icon;
if (pContextName === "Task") {
resultArray = newSelect("TASKID, PARENT_ID, PARENT_CONTEXT, SUBJECT, DESCRIPTION")
.from("TASK")
.where("TASK.TASKID", pID)
.arrayRow();
conf = entities.createConfigForLoadingRows()
.entity("Task_entity")
.fields(["TASKID", "PARENT_ID", "PARENT_CONTEXT", "SUBJECT", "DESCRIPTION"])
.uid(pID);
rowValues = entities.getRow(conf);
resultArray = [rowValues["TASKID"],
rowValues["PARENT_ID"],
rowValues["PARENT_CONTEXT"],
rowValues["SUBJECT"],
rowValues["DESCRIPTION"]];
if (resultArray.length === 0) {
return null;
......@@ -118,11 +130,21 @@ function queryRootElement (pContextName, pID, pGetFirst) {
}
return augmentData(resultArray, "Task");
} else if (pContextName === "Activity") {
resultArray = newSelect("ACTIVITYID, PARENT_ID, PARENT_CONTEXT, SUBJECT, INFO")
.from("ACTIVITY")
.where("ACTIVITY.ACTIVITYID", pID)
.arrayRow();
conf = entities.createConfigForLoadingRows()
.entity("Activity_entity")
.fields(["ACTIVITYID", "PARENT_ID", "PARENT_CONTEXT", "SUBJECT", "INFO", "#IMAGE"])
.uid(pID);
rowValues = entities.getRow(conf);
resultArray = [rowValues["ACTIVITYID"],
rowValues["PARENT_ID"],
rowValues["PARENT_CONTEXT"],
rowValues["SUBJECT"],
rowValues["INFO"]];
icon = rowValues["#IMAGE"];
if (resultArray.length === 0) {
return null;
}
......@@ -133,14 +155,22 @@ function queryRootElement (pContextName, pID, pGetFirst) {
fixedContextName = "Activity";
fixedID = resultArray[0];
}
return augmentData(resultArray, "Activity");
return augmentData(resultArray, "Activity", icon);
}
else if (pContextName === "SupportTicket") {
resultArray = newSelect("TICKETID, PARENT_ID, PARENT_CONTEXT, SUBJECT, DESCRIPTION")
.from("TICKET")
.leftJoin("TASK", "TASK_ID = TASKID")
.where("TICKET.TICKETID", pID)
.arrayRow();
conf = entities.createConfigForLoadingRows()
.entity("SupportTicket_entity")
.fields(["TICKETID", "TASK_PARENT_ID", "TASK_PARENT_CONTEXT", "TASK_SUBJECT", "TASK_DESCRIPTION"])
.uid(pID);
rowValues = entities.getRow(conf);
resultArray = [rowValues["TICKETID"],
rowValues["TASK_PARENT_ID"],
rowValues["TASK_PARENT_CONTEXT"],
rowValues["TASK_SUBJECT"],
rowValues["TASK_DESCRIPTION"]];
if (resultArray.length === 0) {
return null;
......@@ -164,11 +194,12 @@ function queryRootElement (pContextName, pID, pGetFirst) {
* @param pDataRow Requires the following format:
* UID, PARENT_ID, PARENT_CONTEXT, TITLE, DESCRIPTION
* @param pType The type of the row which needs adjustment.
* @param pIcon The Icon (only needed for activities)
* @return Returns the following format:
* UID, KIND, PARENT_ID, PARENT_CONTEX, TITL, DESCRIPTION, ICON
*
*/
function augmentData (pDataRow, pType) {
function augmentData (pDataRow, pType, pIcon) {
if (pDataRow === null || pDataRow === undefined)
return null;
......@@ -190,7 +221,7 @@ function augmentData (pDataRow, pType) {
pDataRow.splice(1, 0, pType);
// Insert icon
pDataRow.splice(6, 0, pType === "Task" ? "VAADIN:TASKS" : pType === "Activity" ? "VAADIN:HOURGLASS_END": pType==="SupportTicket" ? "VAADIN:chat": null);
pDataRow.splice(6, 0, pType === "Task" ? "VAADIN:TASKS" : pType === "Activity" ? pIcon : pType ==="SupportTicket" ? "VAADIN:chat": null);
return pDataRow;
}
\ 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