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

Contact person: new Contact: exclude combinations that already exist

parent d3c585be
No related branches found
No related tags found
No related merge requests found
......@@ -48,13 +48,17 @@
<dependency>
<name>dependency</name>
<entityName>Organisation_entity</entityName>
<fieldName>Organisations</fieldName>
<fieldName>WithPersonIdFilter</fieldName>
</dependency>
<children>
<entityParameter>
<name>WithPrivate_param</name>
<valueProcess>%aditoprj%/entity/Contact_entity/entityfields/organisations/children/withprivate_param/valueProcess.js</valueProcess>
</entityParameter>
<entityParameter>
<name>ExcludeOrganisationsByPersonId</name>
<valueProcess>%aditoprj%/entity/Contact_entity/entityfields/organisations/children/excludeorganisationsbypersonid/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityParameter>
......
import("system.vars");
import("system.result");
var personId = vars.get("$field.PERSON_ID");
result.string(personId);
\ No newline at end of file
......@@ -140,12 +140,6 @@
<fieldName>Organisations</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>7aa5f9b4-6986-4593-a6d8-c4fb03da9c68</name>
<entityName>Contact_entity</entityName>
<fieldName>Organisations</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
<children>
<entityParameter>
......@@ -156,6 +150,10 @@
<name>WithPrivate_param</name>
<expose v="true" />
</entityParameter>
<entityParameter>
<name>ExcludeOrganisationsByPersonId</name>
<expose v="false" />
</entityParameter>
</children>
</entityProvider>
<entityConsumer>
......@@ -633,6 +631,38 @@
</entityParameter>
</children>
</entityConsumer>
<entityParameter>
<name>ExcludeOrganisationsByPersonId</name>
<expose v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityProvider>
<name>WithPersonIdFilter</name>
<fieldType>DEPENDENCY_IN</fieldType>
<dependencies>
<entityDependency>
<name>5a456b04-f0ca-4a45-9c1f-bdfdf074434a</name>
<entityName>Contact_entity</entityName>
<fieldName>Organisations</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
<children>
<entityParameter>
<name>ContactId_param</name>
<expose v="false" />
</entityParameter>
<entityParameter>
<name>ExcludeOrganisationsByPersonId</name>
<title></title>
<expose v="true" />
</entityParameter>
<entityParameter>
<name>WithPrivate_param</name>
<expose v="true" />
</entityParameter>
</children>
</entityProvider>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
......@@ -10,7 +10,11 @@ var cond = SqlCondition.begin()
if (vars.getString("$param.WithPrivate_param") != "true")
cond.andPrepare("ORGANISATION.ORGANISATIONID", "0", "# <> ?");
//TODO: exclude already used (or validation of already used combinations)
var excludeOrgsWithPersonId = vars.get("$param.ExcludeOrganisationsByPersonId")
if (excludeOrgsWithPersonId)
cond.andAttachPrepared(SqlCondition.begin()
.andPrepare("CONTACT.PERSON_ID", excludeOrgsWithPersonId)
.buildSql("ORGANISATION.ORGANISATIONID not in (select CONTACT.ORGANISATION_ID from CONTACT", null, ")"));
//TODO: use a preparedCondition when available #1030812 #1034026
result.string(db.translateCondition(cond.build("1 = 1")));
\ 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