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