diff --git a/entity/Contact_entity/Contact_entity.aod b/entity/Contact_entity/Contact_entity.aod index 87c8f9e0ba807eb30acdce769ee8f965d2df5918..036ac1025f92936706547dd56572f655338c1f7d 100644 --- a/entity/Contact_entity/Contact_entity.aod +++ b/entity/Contact_entity/Contact_entity.aod @@ -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> diff --git a/entity/Contact_entity/entityfields/keywordcontactstates/children/containername_param/valueProcess.js b/entity/Contact_entity/entityfields/keywordcontactstates/children/containername_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..63035752b8a38bb37d120fcf28544a53a175d572 --- /dev/null +++ b/entity/Contact_entity/entityfields/keywordcontactstates/children/containername_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("KeywordRegistry_basic"); + +result.string($KeywordRegistry.contactStatus()); \ No newline at end of file diff --git a/entity/Contact_entity/entityfields/organisation_id/displayValueProcess.js b/entity/Contact_entity/entityfields/organisation_id/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..460b39849d5d34bac95e4b987d28a665b732e860 --- /dev/null +++ b/entity/Contact_entity/entityfields/organisation_id/displayValueProcess.js @@ -0,0 +1,9 @@ +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 diff --git a/entity/Contact_entity/entityfields/organisations/children/withprivat_param/valueProcess.js b/entity/Contact_entity/entityfields/organisations/children/withprivat_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..cda204045d2aba9ae974e0ce2200ba0cc6c852c0 --- /dev/null +++ b/entity/Contact_entity/entityfields/organisations/children/withprivat_param/valueProcess.js @@ -0,0 +1,2 @@ +import("system.result"); +result.string(true); \ No newline at end of file diff --git a/entity/Contact_entity/entityfields/personscontactsexceptown/children/personid_param/valueProcess.js b/entity/Contact_entity/entityfields/personscontactsexceptown/children/personid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..b9088fd5cb96bb08a214dcc3e4b380d35795824f --- /dev/null +++ b/entity/Contact_entity/entityfields/personscontactsexceptown/children/personid_param/valueProcess.js @@ -0,0 +1,14 @@ +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 diff --git a/entity/Contact_entity/entityfields/status/displayValueProcess.js b/entity/Contact_entity/entityfields/status/displayValueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7d0dbe15c01eb79d6bbb72e22ccdf982f5a3e208 --- /dev/null +++ b/entity/Contact_entity/entityfields/status/displayValueProcess.js @@ -0,0 +1,11 @@ +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); +} diff --git a/entity/Contact_entity/entityfields/status/valueProcess.js b/entity/Contact_entity/entityfields/status/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..ab590b059440372f55b8c6d73d0c47eae06ca396 --- /dev/null +++ b/entity/Contact_entity/entityfields/status/valueProcess.js @@ -0,0 +1,7 @@ +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 diff --git a/entity/Contact_entity/entityfields/targetcontext/valueProcess.js b/entity/Contact_entity/entityfields/targetcontext/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..a15d38343e1dfbb1e1e80999aa6f9440cef261ea --- /dev/null +++ b/entity/Contact_entity/entityfields/targetcontext/valueProcess.js @@ -0,0 +1,4 @@ +import("system.result"); +import("Context_lib"); + +result.string(ContextUtils.getContextName("Person")); \ No newline at end of file diff --git a/entity/Contact_entity/recordcontainers/db/conditionProcess.js b/entity/Contact_entity/recordcontainers/db/conditionProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..2433febc9615e28b2ca3a7d32b136122038e2aed --- /dev/null +++ b/entity/Contact_entity/recordcontainers/db/conditionProcess.js @@ -0,0 +1,11 @@ +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 diff --git a/entity/KeywordEntry_entity/KeywordEntry_entity.aod b/entity/KeywordEntry_entity/KeywordEntry_entity.aod index 5ad4909c238d9048eeba907bc96c3d068057d412..4ee519d2d2fa147f18db0da1aafff43a80b73f25 100644 --- a/entity/KeywordEntry_entity/KeywordEntry_entity.aod +++ b/entity/KeywordEntry_entity/KeywordEntry_entity.aod @@ -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> diff --git a/entity/Person_entity/Person_entity.aod b/entity/Person_entity/Person_entity.aod index 16475d8c44acc5f22cc65989fc6ba084054f542a..805cba375933ff33018783a3ea65d53941a3384d 100644 --- a/entity/Person_entity/Person_entity.aod +++ b/entity/Person_entity/Person_entity.aod @@ -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> diff --git a/entity/Person_entity/entityfields/newcontact/onActionProcess.js b/entity/Person_entity/entityfields/newcontact/onActionProcess.js deleted file mode 100644 index 98a6f340f6161c31afe248044b504abb8fd2b78f..0000000000000000000000000000000000000000 --- a/entity/Person_entity/entityfields/newcontact/onActionProcess.js +++ /dev/null @@ -1,4 +0,0 @@ -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 diff --git a/entity/Person_entity/entityfields/organisation_id/displayValueProcess.js b/entity/Person_entity/entityfields/organisation_id/displayValueProcess.js index efe14ce09df366b0c5b96e6dadb3c309e9d98469..460b39849d5d34bac95e4b987d28a665b732e860 100644 --- a/entity/Person_entity/entityfields/organisation_id/displayValueProcess.js +++ b/entity/Person_entity/entityfields/organisation_id/displayValueProcess.js @@ -1,16 +1,9 @@ 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 diff --git a/entity/Person_entity/entityfields/othercontacts/children/owncontactid_param/valueProcess.js b/entity/Person_entity/entityfields/othercontacts/children/owncontactid_param/valueProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..7b6137b4d105e9ba592cf8ef6e796fb838a32b09 --- /dev/null +++ b/entity/Person_entity/entityfields/othercontacts/children/owncontactid_param/valueProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$field.CONTACTID")); \ No newline at end of file diff --git a/neonContext/Contact/Contact.aod b/neonContext/Contact/Contact.aod index 9a0e9a6ac170597a402dab51cdbca7b7217e17d0..3ad4a70c1f640792a4944db95a21992e29b69a45 100644 --- a/neonContext/Contact/Contact.aod +++ b/neonContext/Contact/Contact.aod @@ -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> diff --git a/neonView/ContactList_view/ContactList_view.aod b/neonView/ContactList_view/ContactList_view.aod new file mode 100644 index 0000000000000000000000000000000000000000..c52c92ef4741d91032467412dfa1469157f82f3a --- /dev/null +++ b/neonView/ContactList_view/ContactList_view.aod @@ -0,0 +1,40 @@ +<?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> diff --git a/neonView/PersonMain_view/PersonMain_view.aod b/neonView/PersonMain_view/PersonMain_view.aod index d0e56b27d9011bf318bdd8587fe73a20e05408a2..c27980a4d2bd69fc3363fc3246522c1e9dab783c 100644 --- a/neonView/PersonMain_view/PersonMain_view.aod +++ b/neonView/PersonMain_view/PersonMain_view.aod @@ -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> diff --git a/process/Contact_lib/process.js b/process/Contact_lib/process.js index 628de9c354be6ef009c430f68d0d91d77f2dbca9..b3e659f848a3d5c46b8376121477ea329ebbffac 100644 --- a/process/Contact_lib/process.js +++ b/process/Contact_lib/process.js @@ -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