Skip to content
Snippets Groups Projects
Commit db8d39a0 authored by Benjamin Ulrich's avatar Benjamin Ulrich :speech_balloon:
Browse files

[Projekt: Entwicklung - Neon][TicketNr.: 1054657][Person Index affectedIds retrurn [null]]

parent e889c696
No related branches found
No related tags found
No related merge requests found
......@@ -4,47 +4,52 @@ import("system.vars");
import("IndexSearch_lib");
import("Sql_lib");
var infoContainer, onUpdFn, tableName, res;
var infoContainer, onUpdFn, tableName, res, action;
tableName = vars.get("$local.table");
idValue = vars.get("$local.idvalue");
infoContainer = IndexsearchUtils.createAffectedInfoContainer(idValue, null, vars.get("$local.action")
,function (){return vars.get("$local.columns")}
,function (){return vars.get("$local.oldvalues")}
,function (){return vars.get("$local.values")});
action = vars.get("$local.action");
switch (tableName)
if(action == "D")
result.object([idValue]);
else
{
case "CONTACT":
res = [idValue];
break;
case "ORGANISATION":
res = newSelect("CONTACT.CONTACTID")
.from("CONTACT")
.where("CONTACT.PERSON_ID is null")
.and("CONTACT.ORGANISATION_ID", idValue)
.arrayColumn();
break;
case "ADDRESS":
res = IndexsearchUtils.getAffectedIdValues("CONTACT_ID", infoContainer, function (id){
return newSelect("ADDRESS.CONTACT_ID")
.from("ADDRESS")
.where("ADDRESS.ADDRESSID", id)
.arrayColumn();
});
break;
case "COMMUNICATION":
res = IndexsearchUtils.getAffectedIdValues("CONTACT_ID", infoContainer, function (id){
return newSelect("COMMUNICATION.CONTACT_ID")
.from("COMMUNICATION")
.where("COMMUNICATION.COMMUNICATIONID", id)
.arrayColumn();
});
break;
default:
res = []; //needed, because the Index is being rebuilt if nothing gets returned
}
infoContainer = IndexsearchUtils.createAffectedInfoContainer(idValue, null, vars.get("$local.action")
,function (){return vars.get("$local.columns")}
,function (){return vars.get("$local.oldvalues")}
,function (){return vars.get("$local.values")});
result.object(res);
switch (tableName)
{
case "CONTACT":
res = [idValue];
break;
case "ORGANISATION":
res = newSelect("CONTACT.CONTACTID")
.from("CONTACT")
.where("CONTACT.PERSON_ID is null")
.and("CONTACT.ORGANISATION_ID", idValue)
.arrayColumn();
break;
case "ADDRESS":
res = IndexsearchUtils.getAffectedIdValues("CONTACT_ID", infoContainer, function (id){
return newSelect("ADDRESS.CONTACT_ID")
.from("ADDRESS")
.where("ADDRESS.ADDRESSID", id)
.arrayColumn();
});
break;
case "COMMUNICATION":
res = IndexsearchUtils.getAffectedIdValues("CONTACT_ID", infoContainer, function (id){
return newSelect("COMMUNICATION.CONTACT_ID")
.from("COMMUNICATION")
.where("COMMUNICATION.COMMUNICATIONID", id)
.arrayColumn();
});
break;
default:
res = []; //needed, because the Index is being rebuilt if nothing gets returned
}
result.object(res);
}
\ No newline at end of file
......@@ -4,52 +4,57 @@ import("system.vars");
import("IndexSearch_lib");
import("Sql_lib");
var infoContainer, onUpdFn, tableName, res;
var infoContainer, onUpdFn, tableName, res, action;
tableName = vars.get("$local.table");
idValue = vars.get("$local.idvalue");
infoContainer = IndexsearchUtils.createAffectedInfoContainer(idValue, null, vars.get("$local.action")
,function (){return vars.get("$local.columns")}
,function (){return vars.get("$local.oldvalues")}
,function (){return vars.get("$local.values")});
switch (tableName)
action = vars.get("$local.action");
if (action == "D")
result.object([idValue]);
else
{
case "CONTACT":
res = [idValue];
break;
case "PERSON":
res = newSelect("CONTACT.CONTACTID")
.from("CONTACT")
.where("CONTACT.PERSON_ID", idValue)
.arrayColumn();
break;
case "ORGANISATION":
res = newSelect("CONTACT.CONTACTID")
.from("CONTACT")
.where("CONTACT.ORGANISATION_ID", idValue)
.and("CONTACT.PERSON_ID is not null")
.arrayColumn();
break;
case "ADDRESS":
res = IndexsearchUtils.getAffectedIdValues("CONTACT_ID", infoContainer, function (id){
return newSelect("ADDRESS.CONTACT_ID")
.from("ADDRESS")
.where("ADDRESS.ADDRESSID", id)
.arrayColumn();
});
break;
case "COMMUNICATION":
res = IndexsearchUtils.getAffectedIdValues("CONTACT_ID", infoContainer, function (id){
return newSelect("COMMUNICATION.CONTACT_ID")
.from("COMMUNICATION")
.where("COMMUNICATION.COMMUNICATIONID", id)
.arrayColumn();
});
break;
default:
res = []; //needed, because the Index is being rebuilt if nothing gets returned
break;
}
infoContainer = IndexsearchUtils.createAffectedInfoContainer(idValue, null, vars.get("$local.action")
,function (){return vars.get("$local.columns")}
,function (){return vars.get("$local.oldvalues")}
,function (){return vars.get("$local.values")});
switch (tableName)
{
case "CONTACT":
res = [idValue];
break;
case "PERSON":
res = newSelect("CONTACT.CONTACTID")
.from("CONTACT")
.where("CONTACT.PERSON_ID", idValue)
.arrayColumn();
break;
case "ORGANISATION":
res = newSelect("CONTACT.CONTACTID")
.from("CONTACT")
.where("CONTACT.ORGANISATION_ID", idValue)
.and("CONTACT.PERSON_ID is not null")
.arrayColumn();
break;
case "ADDRESS":
res = IndexsearchUtils.getAffectedIdValues("CONTACT_ID", infoContainer, function (id){
return newSelect("ADDRESS.CONTACT_ID")
.from("ADDRESS")
.where("ADDRESS.ADDRESSID", id)
.arrayColumn();
});
break;
case "COMMUNICATION":
res = IndexsearchUtils.getAffectedIdValues("CONTACT_ID", infoContainer, function (id){
return newSelect("COMMUNICATION.CONTACT_ID")
.from("COMMUNICATION")
.where("COMMUNICATION.COMMUNICATIONID", id)
.arrayColumn();
});
break;
default:
res = []; //needed, because the Index is being rebuilt if nothing gets returned
}
result.object(res);
\ No newline at end of file
result.object(res);
}
\ 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