Skip to content
Snippets Groups Projects
Commit 59f2b63d authored by Johannes Hörmann's avatar Johannes Hörmann
Browse files

Product Lookup for Org / PERS (Relation)

parent d1b0acbb
No related branches found
No related tags found
No related merge requests found
Showing
with 381 additions and 2 deletions
......@@ -234,6 +234,12 @@
<fieldName>SalesprojectOrg_dfo</fieldName>
<isOutgoing v="false" />
</entityDependency>
<entityDependency>
<name>e56d51be-aaf7-4ddc-8bed-7a4a3c42b4dd</name>
<entityName>Relation_entity</entityName>
<fieldName>RelationOrg_dfo</fieldName>
<isOutgoing v="false" />
</entityDependency>
</dependencies>
</entityIncomingField>
<entityOutgoingField>
......@@ -422,12 +428,25 @@
</entityParameter>
</children>
</entityOutgoingField>
<entityIncomingField>
<name>RelationOrg_dfi</name>
<fieldType>DEPENDENCY_IN</fieldType>
<recordContainer>db</recordContainer>
</entityIncomingField>
<entityParameter>
<name>relationId_param</name>
<expose v="true" />
<triggerRecalculation v="true" />
<mandatory v="false" />
<description>PARAMETER</description>
</entityParameter>
</entityFields>
<recordContainers>
<dbRecordContainer>
<name>db</name>
<alias>Data_alias</alias>
<fromClauseProcess>%aditoprj%/entity/Org_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess>
<conditionProcess>%aditoprj%/entity/Org_entity/recordcontainers/db/conditionProcess.js</conditionProcess>
<linkInformation>
<linkInformation>
<name>52a335e2-a9f7-4fe6-b784-00c2db47e014</name>
......
import("system.db");
import("system.result");
import("Sql_lib");
//TODO: use a preparedCondition when available
result.string(db.translateCondition(
SqlCondition.begin()
.andPrepareVars("ORG.RELATION_ID", "$param.relationId_param")
.build("1 = 1")));
\ No newline at end of file
......@@ -483,6 +483,19 @@
<element>TITLESUFFIX</element>
</fields>
</entityFieldGroup>
<entityIncomingField>
<name>RelationPers_dfi</name>
<fieldType>DEPENDENCY_IN</fieldType>
<recordContainer>db</recordContainer>
<dependencies>
<entityDependency>
<name>0b209ee1-3c13-4660-91c4-4d2a2c6cea77</name>
<entityName>Relation_entity</entityName>
<fieldName>RelationPers_dfo</fieldName>
<isOutgoing v="false" />
</entityDependency>
</dependencies>
</entityIncomingField>
</entityFields>
<recordContainers>
<dbRecordContainer>
......
......@@ -277,7 +277,7 @@
<tableName>PRODUCT</tableName>
<columnName>RELATION_ID</columnName>
<linkedContextProcess>%aditoprj%/entity/Product_entity/entityfields/relation_id/linkedContextProcess.js</linkedContextProcess>
<outgoingField>ProductOrg_dfo</outgoingField>
<outgoingField>ProductRelation_dfo</outgoingField>
<valueProcess>%aditoprj%/entity/Product_entity/entityfields/relation_id/valueProcess.js</valueProcess>
</entityField>
<entityField>
......@@ -286,6 +286,15 @@
<entityField>
<name>RELATION_PERS_ID</name>
</entityField>
<entityOutgoingField>
<name>ProductRelation_dfo</name>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
<entityName>Relation_entity</entityName>
<fieldName>ProductRelation_dfi</fieldName>
</dependency>
</entityOutgoingField>
</entityFields>
<recordContainers>
<dbRecordContainer>
......@@ -384,7 +393,7 @@
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>RELATION_ID.displayValue</name>
<value>ORG.NAME</value>
<value>PRODUCT.RELATION_ID</value>
</dbRecordFieldMapping>
</recordFieldMappings>
</dbRecordContainer>
......
<?xml version="1.0" encoding="UTF-8"?>
<entity xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.0.5" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.0.5">
<name>Relation_entity</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<recordContainerType>DB</recordContainerType>
<alias>Data_alias</alias>
<recordContainer>db</recordContainer>
<linkInformation>
<linkInformation>
<name>4af52b2e-752a-4aa3-85c0-1ecc7ae5cb30</name>
<tableName>RELATION</tableName>
<primaryKey>RELATIONID</primaryKey>
<isUIDTable v="true" />
</linkInformation>
</linkInformation>
<entityFields>
<entityIncomingField>
<name>#INCOMING</name>
</entityIncomingField>
<entityField>
<name>ADDRESS_ID</name>
<tableName>RELATION</tableName>
<columnName>ADDRESS_ID</columnName>
</entityField>
<entityField>
<name>DATE_EDIT</name>
<tableName>RELATION</tableName>
<columnName>DATE_EDIT</columnName>
<valueProcess>%aditoprj%/entity/Relation_entity/entityfields/date_edit/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>DATE_NEW</name>
<tableName>RELATION</tableName>
<columnName>DATE_NEW</columnName>
<valueProcess>%aditoprj%/entity/Relation_entity/entityfields/date_new/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>LANGUAGE</name>
<tableName>RELATION</tableName>
<columnName>LANGUAGE</columnName>
</entityField>
<entityField>
<name>ORG_ID</name>
<tableName>RELATION</tableName>
<columnName>ORG_ID</columnName>
</entityField>
<entityField>
<name>PERS_ID</name>
<tableName>RELATION</tableName>
<columnName>PERS_ID</columnName>
</entityField>
<entityField>
<name>RELATIONID</name>
<tableName>RELATION</tableName>
<columnName>RELATIONID</columnName>
</entityField>
<entityField>
<name>STATUS</name>
<tableName>RELATION</tableName>
<columnName>STATUS</columnName>
</entityField>
<entityField>
<name>USER_EDIT</name>
<tableName>RELATION</tableName>
<columnName>USER_EDIT</columnName>
<valueProcess>%aditoprj%/entity/Relation_entity/entityfields/user_edit/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>USER_NEW</name>
<tableName>RELATION</tableName>
<columnName>USER_NEW</columnName>
<valueProcess>%aditoprj%/entity/Relation_entity/entityfields/user_new/valueProcess.js</valueProcess>
</entityField>
<entityField>
<name>relationType</name>
<description>Relation type. Value is based on the existance or non-existance of ORG_ID and PERS_ID.
See RelationUtils.getRelationTypeByPersOrg for possible values</description>
<contentType>NUMBER</contentType>
<valueProcess>%aditoprj%/entity/Relation_entity/entityfields/relationtype/valueProcess.js</valueProcess>
</entityField>
<entityOutgoingField>
<name>RelationPers_dfo</name>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
<entityName>Pers_entity</entityName>
<fieldName>RelationPers_dfi</fieldName>
</dependency>
<children>
<entityParameter>
<name>RelationId_param</name>
<code>%aditoprj%/entity/Relation_entity/entityfields/relationpers_dfo/children/relationid_param/code.js</code>
</entityParameter>
</children>
</entityOutgoingField>
<entityOutgoingField>
<name>RelationOrg_dfo</name>
<fieldType>DEPENDENCY_OUT</fieldType>
<dependency>
<name>dependency</name>
<entityName>Org_entity</entityName>
<fieldName>Org_dfi</fieldName>
</dependency>
<children>
<entityParameter>
<name>relationId_param</name>
<code>%aditoprj%/entity/Relation_entity/entityfields/relationorg_dfo/children/relationid_param/code.js</code>
</entityParameter>
</children>
</entityOutgoingField>
<entityIncomingField>
<name>ProductRelation_dfi</name>
<fieldType>DEPENDENCY_IN</fieldType>
<recordContainer>db</recordContainer>
<dependencies>
<entityDependency>
<name>ad58b5da-132a-46a8-abee-0671bfd2e006</name>
<entityName>Product_entity</entityName>
<fieldName>ProductRelation_dfo</fieldName>
<isOutgoing v="false" />
</entityDependency>
</dependencies>
</entityIncomingField>
<entityField>
<name>ORG_NAME</name>
<title>Organisation name</title>
</entityField>
<entityField>
<name>PERS_FIRSTNAME</name>
<title>Firstname</title>
</entityField>
</entityFields>
<recordContainers>
<dbRecordContainer>
<name>db</name>
<alias>Data_alias</alias>
<fromClauseProcess>%aditoprj%/entity/Relation_entity/recordcontainers/db/fromClauseProcess.js</fromClauseProcess>
<linkInformation>
<linkInformation>
<name>7b3fa460-44a1-40f3-89e3-1625ce9c6bb3</name>
<tableName>RELATION</tableName>
<primaryKey>RELATIONID</primaryKey>
<isUIDTable v="true" />
<readonly v="false" />
</linkInformation>
<linkInformation>
<name>6786a204-2cea-42ae-857d-4335bad6b5e4</name>
<tableName>ORG</tableName>
<primaryKey>ORGID</primaryKey>
<isUIDTable v="false" />
<readonly v="true" />
</linkInformation>
<linkInformation>
<name>d15ccb84-6928-4c44-b940-0f5d04826b55</name>
<tableName>PERS</tableName>
<primaryKey>PERSID</primaryKey>
<isUIDTable v="false" />
<readonly v="true" />
</linkInformation>
<linkInformation>
<name>b778622f-449a-4185-b7cb-9b373ba4024f</name>
<tableName>ADDRESS</tableName>
<primaryKey>ADDRESSID</primaryKey>
<isUIDTable v="false" />
<readonly v="true" />
</linkInformation>
</linkInformation>
<recordFieldMappings>
<dbRecordFieldMapping>
<name>ADDRESS_ID.value</name>
<value>RELATION.ADDRESS_ID</value>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>DATE_EDIT.value</name>
<value>RELATION.DATE_EDIT</value>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>DATE_NEW.value</name>
<value>RELATION.DATE_NEW</value>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>LANGUAGE.value</name>
<value>RELATION.LANGUAGE</value>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>ORG_ID.value</name>
<value>RELATION.ORG_ID</value>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>PERS_ID.value</name>
<value>RELATION.PERS_ID</value>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>RELATIONID.value</name>
<value>RELATION.RELATIONID</value>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>STATUS.value</name>
<value>RELATION.STATUS</value>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>USER_EDIT.value</name>
<value>RELATION.USER_EDIT</value>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>USER_NEW.value</name>
<value>RELATION.USER_NEW</value>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>ORG_NAME.value</name>
<value>ORG.NAME</value>
</dbRecordFieldMapping>
<dbRecordFieldMapping>
<name>PERS_FIRSTNAME.value</name>
<value>PERS.FIRSTNAME</value>
</dbRecordFieldMapping>
</recordFieldMappings>
</dbRecordContainer>
</recordContainers>
</entity>
import("system.vars");
import("system.result");
import("system.neon");
if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT)
result.string(vars.getString("$sys.date"));
\ No newline at end of file
import("system.vars");
import("system.result");
import("system.neon");
if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW)
result.string(vars.getString("$sys.date"));
\ No newline at end of file
import("system.vars");
import("system.result");
result.string(vars.get("$field.RELATIONID"));
\ No newline at end of file
import("system.vars");
import("system.result");
result.string(vars.get("$field.RELATIONID"));
\ No newline at end of file
import("system.result");
import("system.vars");
import("Relation_lib")
result.object(RelationUtils.getRelationTypeByPersOrg(vars.get("$field.PERS_ID"), vars.get("$field.ORG_ID")));
\ No newline at end of file
import("system.vars");
import("system.result");
import("system.neon");
if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_EDIT)
result.string(vars.getString("$sys.user"));
\ No newline at end of file
import("system.vars");
import("system.result");
import("system.neon");
if(vars.get("$sys.operatingstate") == neon.OPERATINGSTATE_NEW)
result.string(vars.getString("$sys.user"));
\ No newline at end of file
import("system.result");
import("Relation_lib")
result.string(RelationUtils.getFullRelationFromString());
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<neonContext xmlns="http://www.adito.de/2018/ao/Model" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VERSION="1.0.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonContext/1.0.0">
<name>Relation_context</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<lookupview>RelationLookup_view</lookupview>
<entity>Relation_entity</entity>
<references>
<neonViewReference>
<name>1ea0b1ed-c2b5-4b8c-b359-27ffdef6e5ea</name>
<view>RelationLookup_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.0.0" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/neonView/1.0.0">
<name>RelationLookup_view</name>
<majorModelMode>DISTRIBUTED</majorModelMode>
<layout>
<boxLayout>
<name>layout</name>
</boxLayout>
</layout>
<children>
<tableViewTemplate>
<name>relationLookupList_template</name>
<entityField>#ENTITY</entityField>
<columns>
<neonTableColumn>
<name>ca59a64a-adce-49c3-93ad-2978c81809f8</name>
<entityField>ORG_NAME</entityField>
</neonTableColumn>
<neonTableColumn>
<name>814b3f18-106a-443e-8415-762669f862e6</name>
<entityField>PERS_FIRSTNAME</entityField>
</neonTableColumn>
</columns>
</tableViewTemplate>
</children>
</neonView>
......@@ -74,4 +74,33 @@ RelationUtils.getRelationTypeByPersOrg = function(pPersId, pOrgId)
return 3; // Person einer Organisation da PERS_ID nicht leer und ORG_ID nicht '0'
}
}
}
/**
* returns the from string for the relation joined with org, pers, address
*
* @return {String}
*/
RelationUtils.getFullRelationFromString = function()
{
return "RELATION join ORG on ORG.ORGID = RELATION.ORG_ID"
+ " left join PERS on PERS.PERSID = RELATION.PERS_ID"
+ " left join ADDRESS on ADDRESS.ADDRESSID = RELATION.ADDRESS_ID";
}
/**
* returns the from string for the relation joined with org, pers, address
*
* @param {String} pIdField field used as id
*
* @return {String}
*/
RelationUtils.getFullRelationSelectString = function(pIdField)
{
if(pIdField == undefined)
pIdField = "RELATIONID";
return pIdField + ","
+ concat( [ concat(["SALUTATION", "TITLE", "FIRSTNAME", "LASTNAME"]) , "ORGNAME"], " - " ) + " as anzeige, "
+ "CUSTOMERCODE, ORGNAME, ZIP, CITY, TITLE, FIRSTNAME, LASTNAME, RELTITLE";
}
\ 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