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

person: added list of other contacts

parent a0fa2d59
No related branches found
No related tags found
No related merge requests found
Showing
with 231 additions and 21 deletions
......@@ -18,6 +18,7 @@
<title>Organisation</title>
<consumer>Organisations</consumer>
<mandatory v="true" />
<displayValueProcess>%aditoprj%/entity/Contact_entity/entityfields/organisation_id/displayValueProcess.js</displayValueProcess>
<onValueChange>%aditoprj%/entity/Contact_entity/entityfields/organisation_id/onValueChange.js</onValueChange>
</entityField>
<entityField>
......@@ -47,6 +48,12 @@
<entityName>Organisation_entity</entityName>
<fieldName>#PROVIDER</fieldName>
</dependency>
<children>
<entityParameter>
<name>WithPrivat_param</name>
<valueProcess>%aditoprj%/entity/Contact_entity/entityfields/organisations/children/withprivat_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
<entityParameter>
<name>PersonId_param</name>
......@@ -56,6 +63,12 @@
<entityProvider>
<name>PersonRelated</name>
<fieldType>DEPENDENCY_IN</fieldType>
<children>
<entityParameter>
<name>OwnContactId_param</name>
<expose v="false" />
</entityParameter>
</children>
</entityProvider>
<entityField>
<name>ADDRESS_ID</name>
......@@ -103,6 +116,7 @@
<name>LANGUAGE</name>
<title>Language</title>
<consumer>Languages</consumer>
<mandatory v="true" />
</entityField>
<entityConsumer>
<name>Languages</name>
......@@ -113,11 +127,64 @@
<fieldName>ISO3Name</fieldName>
</dependency>
</entityConsumer>
<entityProvider>
<name>PersonsContactsExceptOwn</name>
<fieldType>DEPENDENCY_IN</fieldType>
<targetContextField>targetContext</targetContextField>
<targetIdField>CONTACTID</targetIdField>
<dependencies>
<entityDependency>
<name>34cc85f4-5555-4631-94fc-f3ad35b7ce7e</name>
<entityName>Person_entity</entityName>
<fieldName>OtherContacts</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
<children>
<entityParameter>
<name>PersonId_param</name>
<valueProcess>%aditoprj%/entity/Contact_entity/entityfields/personscontactsexceptown/children/personid_param/valueProcess.js</valueProcess>
<expose v="false" />
</entityParameter>
</children>
</entityProvider>
<entityParameter>
<name>OwnContactId_param</name>
<expose v="true" />
<description>PARAMETER</description>
</entityParameter>
<entityField>
<name>targetContext</name>
<valueProcess>%aditoprj%/entity/Contact_entity/entityfields/targetcontext/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>STATUS</name>
<title>Status</title>
<consumer>KeywordContactStates</consumer>
<valueProcess>%aditoprj%/entity/Contact_entity/entityfields/status/valueProcess.js</valueProcess>
<displayValueProcess>%aditoprj%/entity/Contact_entity/entityfields/status/displayValueProcess.js</displayValueProcess>
</entityField>
<entityConsumer>
<name>KeywordContactStates</name>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
<entityName>KeywordEntry_entity</entityName>
<fieldName>SpecificContainerKeywords</fieldName>
</dependency>
<children>
<entityParameter>
<name>ContainerName_param</name>
<valueProcess>%aditoprj%/entity/Contact_entity/entityfields/keywordcontactstates/children/containername_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
</entityFields>
<recordContainers>
<dbRecordContainer>
<name>db</name>
<alias>Data_alias</alias>
<conditionProcess>%aditoprj%/entity/Contact_entity/recordcontainers/db/conditionProcess.js</conditionProcess>
<linkInformation>
<linkInformation>
<name>d2a29013-e270-4ce1-8f2d-b372206f0aa3</name>
......@@ -160,6 +227,10 @@
<name>LANGUAGE.value</name>
<recordfield>CONTACT.LANGUAGE</recordfield>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>STATUS.value</name>
<recordfield>CONTACT.STATUS</recordfield>
</dbRecordFieldMapping>
</recordFieldMappings>
</dbRecordContainer>
</recordContainers>
......
import("system.result");
import("KeywordRegistry_basic");
result.string($KeywordRegistry.contactStatus());
\ No newline at end of file
import("system.result");
import("system.db");
import("system.vars");
import("Contact_lib");
var organisationId = vars.get("$field.ORGANISATION_ID");
var res = OrganisationUtils.getNameByOrganisationId(organisationId);
result.string(res);
\ No newline at end of file
import("system.result");
result.string(true);
\ No newline at end of file
import("system.result");
import("system.vars");
import("system.db");
import("Sql_lib");
var contactId = vars.get("$param.OwnContactId_param");
if (contactId)
{
var sql = SqlCondition.begin()
.andPrepare("CONTACT.CONTACTID", contactId)
.buildSql("select CONTACT.PERSON_ID from CONTACT");
var personId = db.cell(sql);
result.string(personId);
}
\ No newline at end of file
import("system.result");
import("system.vars");
import("KeywordRegistry_basic");
import("Keyword_lib");
var key = vars.get("$field.STATUS");
if (key)
{
var res = KeywordUtils.getViewValue($KeywordRegistry.contactStatus(), key);
result.string(res);
}
import("system.vars");
import("system.result");
import("system.neon");
import("KeywordRegistry_basic");
if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value"))
result.string($KeywordRegistry.contactStatus$active());
\ No newline at end of file
import("system.result");
import("Context_lib");
result.string(ContextUtils.getContextName("Person"));
\ No newline at end of file
import("system.vars");
import("system.db");
import("system.result");
import("Sql_lib");
var cond = new SqlCondition();
cond.andPrepareVars("CONTACT.CONTACTID", "$param.OwnContactId_param", "# != ?");
cond.andPrepareVars("CONTACT.PERSON_ID", "$param.PersonId_param");
//TODO: use a preparedCondition when available #1030812 #1034026
result.string(db.translateCondition(cond.build("1 = 2")));
\ No newline at end of file
......@@ -360,6 +360,12 @@
<fieldName>KeywordContactStates</fieldName>
<isConsumer v="false" />
</entityDependency>
<entityDependency>
<name>7945545b-f1e6-446d-84c3-ef68486652f4</name>
<entityName>Contact_entity</entityName>
<fieldName>KeywordContactStates</fieldName>
<isConsumer v="false" />
</entityDependency>
</dependencies>
<children>
<entityParameter>
......
......@@ -694,13 +694,6 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
</entityParameter>
</children>
</entityConsumer>
<entityActionField>
<name>newContact</name>
<fieldType>ACTION</fieldType>
<title>New contact</title>
<onActionProcess>%aditoprj%/entity/Person_entity/entityfields/newcontact/onActionProcess.js</onActionProcess>
<iconId>VAADIN:USERS</iconId>
</entityActionField>
<entityField>
<name>DEPARTMENT</name>
<title>Department</title>
......@@ -713,6 +706,22 @@ Usually this is used for filtering COMMUNICATION-entries by a specified contact
<name>CONTACTROLE</name>
<title>Contactrole</title>
</entityField>
<entityConsumer>
<name>OtherContacts</name>
<title>Other Contactroles</title>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
<entityName>Contact_entity</entityName>
<fieldName>PersonsContactsExceptOwn</fieldName>
</dependency>
<children>
<entityParameter>
<name>OwnContactId_param</name>
<valueProcess>%aditoprj%/entity/Person_entity/entityfields/othercontacts/children/owncontactid_param/valueProcess.js</valueProcess>
</entityParameter>
</children>
</entityConsumer>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
import("system.vars");
import("system.neon");
neon.openContext("Contact", null, null, neon.OPERATINGSTATE_NEW, {PersonId_param: vars.get("$field.PERSON_ID")});
\ No newline at end of file
import("system.result");
import("system.db");
import("system.vars");
import("Sql_lib");
import("Contact_lib");
var organisationId = vars.get("$field.ORGANISATION_ID");
var orgname = "";
if (organisationId)
{
res = db.cell(SqlCondition.begin()
.andPrepare("ORGANISATION.ORGANISATIONID", organisationId)
.buildSql("select ORGANISATION.NAME from ORGANISATION"));
}
var res = OrganisationUtils.getNameByOrganisationId(organisationId);
result.string(res);
\ No newline at end of file
import("system.vars");
import("system.result");
result.string(vars.get("$field.CONTACTID"));
\ No newline at end of file
......@@ -9,5 +9,9 @@
<name>c96479fe-4f9c-433d-9de3-c2e1bbb5aac7</name>
<view>ContactEdit_view</view>
</neonViewReference>
<neonViewReference>
<name>dde4fdab-4a5e-4183-8d4d-4e96d34054c7</name>
<view>ContactList_view</view>
</neonViewReference>
</references>
</neonContext>
<?xml version="1.0" encoding="UTF-8"?>
<neonView xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.1.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.1.0">
<name>ContactList_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<layout>
<boxLayout>
<name>layout</name>
</boxLayout>
</layout>
<children>
<tableViewTemplate>
<name>main</name>
<hideContentSearch v="true" />
<isEditable v="false" />
<entityField>#ENTITY</entityField>
<columns>
<neonTableColumn>
<name>ef71b5ad-8581-4845-ae66-7df17d1459e0</name>
<entityField>ORGANISATION_ID</entityField>
</neonTableColumn>
<neonTableColumn>
<name>a3f3a2b8-1f7a-4783-b080-1853df3d1613</name>
<entityField>CONTACTROLE</entityField>
</neonTableColumn>
<neonTableColumn>
<name>a8f4283d-7a40-4ee9-ae34-e4d424a9342a</name>
<entityField>DEPARTMENT</entityField>
</neonTableColumn>
<neonTableColumn>
<name>13b085a4-9ee7-418b-b3a9-acaf053c44f1</name>
<entityField>POSITION</entityField>
</neonTableColumn>
<neonTableColumn>
<name>1daa17e8-0e8d-4760-b229-651ae9a121d3</name>
<entityField>STATUS</entityField>
</neonTableColumn>
</columns>
</tableViewTemplate>
</children>
</neonView>
......@@ -54,5 +54,10 @@
<entityField>Attributes</entityField>
<view>AttributeRelationFilter_view</view>
</neonViewReference>
<neonViewReference>
<name>c2606a8b-eac1-412e-893d-bb788d4a5b5c</name>
<entityField>OtherContacts</entityField>
<view>ContactList_view</view>
</neonViewReference>
</children>
</neonView>
......@@ -7,7 +7,27 @@ import("Util_lib");
import("Context_lib");
/**
* a static Utility class for relations
* a static Utility class for organisations
*
* Do not create an instance of this!
* @class
*/
function OrganisationUtils() {}
OrganisationUtils.getNameByOrganisationId = function(pOrganisationId)
{
var orgname = "";
if (pOrganisationId)
{
orgname = db.cell(SqlCondition.begin()
.andPrepare("ORGANISATION.ORGANISATIONID", pOrganisationId)
.buildSql("select ORGANISATION.NAME from ORGANISATION"));
}
return orgname;
};
/**
* a static Utility class for contacts
*
* Do not create an instance of this!
* @class
......
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