Skip to content
Snippets Groups Projects
Commit 7b3f940a authored by Sascha Schmidt's avatar Sascha Schmidt
Browse files

[Projekt: xRM-ContactManagement][TicketNr.: 2001171][Serienaktion...

[Projekt: xRM-ContactManagement][TicketNr.: 2001171][Serienaktion Eigenschaften setzen in Aktivität fehlerhaft]
parent cd4ac46c
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,7 @@
</entityProvider>
<entityField>
<name>UID</name>
<state>INVISIBLE</state>
</entityField>
<entityField>
<name>affectedData</name>
......
......@@ -3,5 +3,5 @@ import("system.vars");
if(vars.get("$local.idvalues"))
{
result.object([vars.get("$local.idvalues")]);
result.object([vars.get("$local.idvalues")]);
}
\ No newline at end of file
......@@ -19,6 +19,15 @@
</entityFieldLink>
</fields>
</scoreCardViewTemplate>
<genericViewTemplate>
<name>tst</name>
<fields>
<entityFieldLink>
<name>6938d0f4-c4a6-4caf-9fd0-eb082f01d9af</name>
<entityField>UID</entityField>
</entityFieldLink>
</fields>
</genericViewTemplate>
<neonViewReference>
<name>3f715b52-ef4b-4b62-916c-0a23833bc2da</name>
<entityField>AddAttributeToSelectionMultiEdit</entityField>
......
import("system.logging");
import("Util_lib");
import("system.neon");
import("Sql_lib");
......@@ -24,70 +23,70 @@ function FilterViewActionUtils() {}
FilterViewActionUtils.getUidsByEntityFilter = function (pContext, pFilter, pParameters)
{
if (Utils.isString(pFilter))
{
pFilter = JSON.parse(pFilter);
}
if (Utils.isString(pParameters))
{
pParameters = JSON.parse(pParameters);
}
//uids from Person and Organisation are loaded with simple sql queries because that's much faster than over the entity'
//TODO: design modular + filter recipe
if (pContext == "Person" && "condition" in pFilter)
{
return new SqlBuilder()
.selectDistinct("CONTACT.CONTACTID")
.from("PERSON")
.join("CONTACT", "CONTACT.PERSON_ID = PERSON.PERSONID")
.join("ORGANISATION", "ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID")
.leftJoin("ADDRESS", "ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID")
.whereIfSet(pFilter.condition)
.arrayColumn();
}
if (pContext == "Organisation" && "condition" in pFilter)
{
return new SqlBuilder()
.selectDistinct("CONTACT.CONTACTID")
.from("ORGANISATION")
.join("CONTACT", newWhere("ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID").and("CONTACT.PERSON_ID is null"))
.leftJoin("ADDRESS", "ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID")
.leftJoin("CLASSIFICATIONSTORAGE", "CLASSIFICATIONSTORAGE.OBJECT_ROWID = CONTACT.CONTACTID")
.whereIfSet(pFilter.condition)
.arrayColumn();
}
if(pContext == "Activity" && "condition" in pFilter)
{
return new SqlBuilder()
.selectDistinct("ACTIVITY.ACTIVITYID")
.from("ACTIVITY")
.leftJoin("CONTACT", "CONTACT.CONTACTID = ACTIVITY.RESPONSIBLE")
.leftJoin("PERSON", "PERSON.PERSONID = CONTACT.PERSON_ID")
.whereIfSet(pFilter.condition)
.arrayColumn();
}
//General solution to get the uids using entities.getRows
var loadRowsConfig = entities.createConfigForLoadingRows()
.entity(ContextUtils.getEntity(pContext))
.fields(["#UID"]);
if (Utils.isNullOrEmpty(pFilter.filter))
{
loadRowsConfig.filter(JSON.stringify(pFilter.filter));
}
if(Utils.isNullOrEmpty(pParameters))
{
Object.keys(pParameters).forEach(function(key){
loadRowsConfig.addParameter(key, pParameters[key])
});
}
return entities.getRows(loadRowsConfig).map(function (row)
{
return row["#UID"];
});
{
pFilter = JSON.parse(pFilter);
}
if (Utils.isString(pParameters))
{
pParameters = JSON.parse(pParameters);
}
//uids from Person and Organisation are loaded with simple sql queries because that's much faster than over the entity'
//TODO: design modular + filter recipe
if (pContext == "Person" && "condition" in pFilter)
{
return new SqlBuilder()
.selectDistinct("CONTACT.CONTACTID")
.from("PERSON")
.join("CONTACT", "CONTACT.PERSON_ID = PERSON.PERSONID")
.join("ORGANISATION", "ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID")
.leftJoin("ADDRESS", "ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID")
.whereIfSet(pFilter.condition)
.arrayColumn();
}
if (pContext == "Organisation" && "condition" in pFilter)
{
return new SqlBuilder()
.selectDistinct("CONTACT.CONTACTID")
.from("ORGANISATION")
.join("CONTACT", newWhere("ORGANISATION.ORGANISATIONID = CONTACT.ORGANISATION_ID").and("CONTACT.PERSON_ID is null"))
.leftJoin("ADDRESS", "ADDRESS.ADDRESSID = CONTACT.ADDRESS_ID")
.leftJoin("CLASSIFICATIONSTORAGE", "CLASSIFICATIONSTORAGE.OBJECT_ROWID = CONTACT.CONTACTID")
.whereIfSet(pFilter.condition)
.arrayColumn();
}
if(pContext == "Activity" && "condition" in pFilter)
{
return new SqlBuilder()
.selectDistinct("ACTIVITY.ACTIVITYID")
.from("ACTIVITY")
.leftJoin("CONTACT", "CONTACT.CONTACTID = ACTIVITY.RESPONSIBLE")
.leftJoin("PERSON", "PERSON.PERSONID = CONTACT.PERSON_ID")
.whereIfSet(pFilter.condition)
.arrayColumn();
}
//General solution to get the uids using entities.getRows
var loadRowsConfig = entities.createConfigForLoadingRows()
.entity(ContextUtils.getEntity(pContext))
.fields(["#UID"]);
if (Utils.isNullOrEmpty(pFilter.filter))
{
loadRowsConfig.filter(JSON.stringify(pFilter.filter));
}
if(Utils.isNullOrEmpty(pParameters))
{
Object.keys(pParameters).forEach(function(key){
loadRowsConfig.addParameter(key, pParameters[key])
});
}
return entities.getRows(loadRowsConfig).map(function (row)
{
return row["#UID"];
});
}
/**
......
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