diff --git a/entity/Activity_entity/Activity_entity.aod b/entity/Activity_entity/Activity_entity.aod index 2b9bfcbde13220c2de33cde0c8364cebbda99984..4f5dc80a97a7db7cd69efc6ed644d4d110badc5b 100644 --- a/entity/Activity_entity/Activity_entity.aod +++ b/entity/Activity_entity/Activity_entity.aod @@ -225,10 +225,12 @@ <entityParameter> <name>ObjectId_param</name> <expose v="false" /> + <documentation>%aditoprj%/entity/Activity_entity/entityfields/activitybyid_dfi/children/objectid_param/documentation.adoc</documentation> </entityParameter> <entityParameter> <name>OnlyInnate_param</name> <expose v="false" /> + <documentation>%aditoprj%/entity/Activity_entity/entityfields/activitybyid_dfi/children/onlyinnate_param/documentation.adoc</documentation> </entityParameter> <entityParameter> <name>RowId_param</name> diff --git a/entity/Activity_entity/entityfields/activitybyid_dfi/children/objectid_param/documentation.adoc b/entity/Activity_entity/entityfields/activitybyid_dfi/children/objectid_param/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..004d34fa79b5bd7c213ddd5935ecf9dca4c5ac28 --- /dev/null +++ b/entity/Activity_entity/entityfields/activitybyid_dfi/children/objectid_param/documentation.adoc @@ -0,0 +1,3 @@ +The `ObjectId_param`-param specifies the object type of a `RowId_param`. +For example if you pass a `RELATIONID` [of a contactperson] as `RowId_param` you've to specify the type[the `ObjObjectId_param`] as contactperson. + diff --git a/entity/Activity_entity/entityfields/activitybyid_dfi/children/onlyinnate_param/documentation.adoc b/entity/Activity_entity/entityfields/activitybyid_dfi/children/onlyinnate_param/documentation.adoc new file mode 100644 index 0000000000000000000000000000000000000000..abd18febe748f73d214ba89835a2abf043029c79 --- /dev/null +++ b/entity/Activity_entity/entityfields/activitybyid_dfi/children/onlyinnate_param/documentation.adoc @@ -0,0 +1 @@ +The `OnlyInnate_param` specifies a filter where only own records (records you created) are displayed. \ No newline at end of file diff --git a/entity/AttributeRelation_entity/AttributeRelation_entity.aod b/entity/AttributeRelation_entity/AttributeRelation_entity.aod index d92ad249c9ebc10a8bccf67700f3c58b0d3ca4e3..bac8c88e4335ba9eebe1061bf99071e9dc176fb5 100644 --- a/entity/AttributeRelation_entity/AttributeRelation_entity.aod +++ b/entity/AttributeRelation_entity/AttributeRelation_entity.aod @@ -1,167 +1,167 @@ -<?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.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.1.1"> - <name>AttributeRelation_entity</name> - <title>Attribute Relation</title> - <majorModelMode>DISTRIBUTED</majorModelMode> - <documentation>%aditoprj%/entity/AttributeRelation_entity/documentation.adoc</documentation> - <recordContainer>db</recordContainer> - <entityFields> - <entityIncomingField> - <name>#INCOMING</name> - </entityIncomingField> - <entityField> - <name>AB_ATTRIBUTERELATIONID</name> - <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attributerelationid/valueProcess.js</valueProcess> - </entityField> - <entityField> - <name>AB_ATTRIBUTE_ID</name> - <title>Attribute</title> - <mandatory v="true" /> - <possibleItemsProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attribute_id/possibleItemsProcess.js</possibleItemsProcess> - <stateProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attribute_id/stateProcess.js</stateProcess> - </entityField> - <entityField> - <name>OBJECT_ROWID</name> - <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/object_rowid/valueProcess.js</valueProcess> - </entityField> - <entityField> - <name>OBJECT_TYPE</name> - <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/object_type/valueProcess.js</valueProcess> - </entityField> - <entityField> - <name>DATE_NEW</name> - <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/date_new/valueProcess.js</valueProcess> - </entityField> - <entityField> - <name>DATE_EDIT</name> - </entityField> - <entityField> - <name>USER_NEW</name> - <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/user_new/valueProcess.js</valueProcess> - </entityField> - <entityField> - <name>USER_EDIT</name> - </entityField> - <entityField> - <name>ATTRIBUTERELATION_VALUE</name> - <title>Value</title> - <contentTypeProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/attributerelation_value/contentTypeProcess.js</contentTypeProcess> - <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/attributerelation_value/valueProcess.js</valueProcess> - <onValueChange>%aditoprj%/entity/AttributeRelation_entity/entityfields/attributerelation_value/onValueChange.js</onValueChange> - </entityField> - <entityField> - <name>CHAR_VALUE</name> - </entityField> - <entityIncomingField> - <name>OrgAttr_dfi</name> - <fieldType>DEPENDENCY_IN</fieldType> - <recordContainer>db</recordContainer> - <dependencies> - <entityDependency> - <name>2226c7fc-45d4-45e8-a5d3-a5e13dff4b59</name> - <entityName>Org_entity</entityName> - <fieldName>OrgAttr_dfo</fieldName> - <isOutgoing v="false" /> - </entityDependency> - </dependencies> - </entityIncomingField> - <entityParameter> - <name>objectRowId_param</name> - <expose v="true" /> - <description>PARAMETER</description> - </entityParameter> - <entityField> - <name>DATE_VALUE</name> - <contentType>DATE</contentType> - <state>EDITABLE</state> - </entityField> - <entityField> - <name>NUMBER_VALUE</name> - <contentType>NUMBER</contentType> - <state>EDITABLE</state> - </entityField> - <entityParameter> - <name>objectType_param</name> - <expose v="true" /> - <description>PARAMETER</description> - </entityParameter> - <entityField> - <name>BOOL_VALUE</name> - <contentType>BOOLEAN</contentType> - <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/bool_value/valueProcess.js</valueProcess> - </entityField> - <entityField> - <name>ID_VALUE</name> - </entityField> - </entityFields> - <recordContainers> - <dbRecordContainer> - <name>db</name> - <alias>Data_alias</alias> - <conditionProcess>%aditoprj%/entity/AttributeRelation_entity/recordcontainers/db/conditionProcess.js</conditionProcess> - <linkInformation> - <linkInformation> - <name>1ffc8a7d-56a2-4516-abd9-071e857058e9</name> - <tableName>AB_ATTRIBUTERELATION</tableName> - <primaryKey>AB_ATTRIBUTERELATIONID</primaryKey> - <isUIDTable v="true" /> - <readonly v="false" /> - </linkInformation> - </linkInformation> - <recordFieldMappings> - <dbRecordFieldMapping> - <name>AB_ATTRIBUTE_ID.value</name> - <recordfield>AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>AB_ATTRIBUTERELATIONID.value</name> - <recordfield>AB_ATTRIBUTERELATION.AB_ATTRIBUTERELATIONID</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>OBJECT_ROWID.value</name> - <recordfield>AB_ATTRIBUTERELATION.OBJECT_ROWID</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>OBJECT_TYPE.value</name> - <recordfield>AB_ATTRIBUTERELATION.OBJECT_TYPE</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>DATE_EDIT.value</name> - <recordfield>AB_ATTRIBUTERELATION.DATE_EDIT</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>DATE_NEW.value</name> - <recordfield>AB_ATTRIBUTERELATION.DATE_NEW</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>USER_EDIT.value</name> - <recordfield>AB_ATTRIBUTERELATION.USER_EDIT</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>USER_NEW.value</name> - <recordfield>AB_ATTRIBUTERELATION.USER_NEW</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>CHAR_VALUE.value</name> - <recordfield>AB_ATTRIBUTERELATION.CHAR_VALUE</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>DATE_VALUE.value</name> - <recordfield>AB_ATTRIBUTERELATION.DATE_VALUE</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>NUMBER_VALUE.value</name> - <recordfield>AB_ATTRIBUTERELATION.NUMBER_VALUE</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>BOOL_VALUE.value</name> - <recordfield>AB_ATTRIBUTERELATION.BOOL_VALUE</recordfield> - </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>ID_VALUE.value</name> - <recordfield>AB_ATTRIBUTERELATION.ID_VALUE</recordfield> - </dbRecordFieldMapping> - </recordFieldMappings> - </dbRecordContainer> - </recordContainers> -</entity> +<?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.1.1" xsi:schemaLocation="http://www.adito.de/2018/ao/Model adito://models/xsd/entity/1.1.1"> + <name>AttributeRelation_entity</name> + <title>Attribute Relation</title> + <majorModelMode>DISTRIBUTED</majorModelMode> + <documentation>%aditoprj%/entity/AttributeRelation_entity/documentation.adoc</documentation> + <recordContainer>db</recordContainer> + <entityFields> + <entityIncomingField> + <name>#INCOMING</name> + </entityIncomingField> + <entityField> + <name>AB_ATTRIBUTERELATIONID</name> + <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attributerelationid/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>AB_ATTRIBUTE_ID</name> + <title>Attribute</title> + <mandatory v="true" /> + <possibleItemsProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attribute_id/possibleItemsProcess.js</possibleItemsProcess> + <stateProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/ab_attribute_id/stateProcess.js</stateProcess> + </entityField> + <entityField> + <name>OBJECT_ROWID</name> + <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/object_rowid/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>OBJECT_TYPE</name> + <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/object_type/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>DATE_NEW</name> + <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/date_new/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>DATE_EDIT</name> + </entityField> + <entityField> + <name>USER_NEW</name> + <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/user_new/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>USER_EDIT</name> + </entityField> + <entityField> + <name>ATTRIBUTERELATION_VALUE</name> + <title>Value</title> + <contentTypeProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/attributerelation_value/contentTypeProcess.js</contentTypeProcess> + <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/attributerelation_value/valueProcess.js</valueProcess> + <onValueChange>%aditoprj%/entity/AttributeRelation_entity/entityfields/attributerelation_value/onValueChange.js</onValueChange> + </entityField> + <entityField> + <name>CHAR_VALUE</name> + </entityField> + <entityIncomingField> + <name>OrgAttr_dfi</name> + <fieldType>DEPENDENCY_IN</fieldType> + <recordContainer>db</recordContainer> + <dependencies> + <entityDependency> + <name>2226c7fc-45d4-45e8-a5d3-a5e13dff4b59</name> + <entityName>Org_entity</entityName> + <fieldName>OrgAttr_dfo</fieldName> + <isOutgoing v="false" /> + </entityDependency> + </dependencies> + </entityIncomingField> + <entityParameter> + <name>objectRowId_param</name> + <expose v="true" /> + <description>PARAMETER</description> + </entityParameter> + <entityField> + <name>DATE_VALUE</name> + <contentType>DATE</contentType> + <state>EDITABLE</state> + </entityField> + <entityField> + <name>NUMBER_VALUE</name> + <contentType>NUMBER</contentType> + <state>EDITABLE</state> + </entityField> + <entityParameter> + <name>objectType_param</name> + <expose v="true" /> + <description>PARAMETER</description> + </entityParameter> + <entityField> + <name>BOOL_VALUE</name> + <contentType>BOOLEAN</contentType> + <valueProcess>%aditoprj%/entity/AttributeRelation_entity/entityfields/bool_value/valueProcess.js</valueProcess> + </entityField> + <entityField> + <name>ID_VALUE</name> + </entityField> + </entityFields> + <recordContainers> + <dbRecordContainer> + <name>db</name> + <alias>Data_alias</alias> + <conditionProcess>%aditoprj%/entity/AttributeRelation_entity/recordcontainers/db/conditionProcess.js</conditionProcess> + <linkInformation> + <linkInformation> + <name>1ffc8a7d-56a2-4516-abd9-071e857058e9</name> + <tableName>AB_ATTRIBUTERELATION</tableName> + <primaryKey>AB_ATTRIBUTERELATIONID</primaryKey> + <isUIDTable v="true" /> + <readonly v="false" /> + </linkInformation> + </linkInformation> + <recordFieldMappings> + <dbRecordFieldMapping> + <name>AB_ATTRIBUTE_ID.value</name> + <recordfield>AB_ATTRIBUTERELATION.AB_ATTRIBUTE_ID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>AB_ATTRIBUTERELATIONID.value</name> + <recordfield>AB_ATTRIBUTERELATION.AB_ATTRIBUTERELATIONID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>OBJECT_ROWID.value</name> + <recordfield>AB_ATTRIBUTERELATION.OBJECT_ROWID</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>OBJECT_TYPE.value</name> + <recordfield>AB_ATTRIBUTERELATION.OBJECT_TYPE</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DATE_EDIT.value</name> + <recordfield>AB_ATTRIBUTERELATION.DATE_EDIT</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DATE_NEW.value</name> + <recordfield>AB_ATTRIBUTERELATION.DATE_NEW</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>USER_EDIT.value</name> + <recordfield>AB_ATTRIBUTERELATION.USER_EDIT</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>USER_NEW.value</name> + <recordfield>AB_ATTRIBUTERELATION.USER_NEW</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>CHAR_VALUE.value</name> + <recordfield>AB_ATTRIBUTERELATION.CHAR_VALUE</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>DATE_VALUE.value</name> + <recordfield>AB_ATTRIBUTERELATION.DATE_VALUE</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>NUMBER_VALUE.value</name> + <recordfield>AB_ATTRIBUTERELATION.NUMBER_VALUE</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>BOOL_VALUE.value</name> + <recordfield>AB_ATTRIBUTERELATION.BOOL_VALUE</recordfield> + </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>ID_VALUE.value</name> + <recordfield>AB_ATTRIBUTERELATION.ID_VALUE</recordfield> + </dbRecordFieldMapping> + </recordFieldMappings> + </dbRecordContainer> + </recordContainers> +</entity> diff --git a/entity/Comm_entity/Comm_entity.aod b/entity/Comm_entity/Comm_entity.aod index 79f7324d86cd973eaf6c21897dafab7b5fe3603a..dd1ecd5acc36949a58017a26ae606685c3b3a42f 100644 --- a/entity/Comm_entity/Comm_entity.aod +++ b/entity/Comm_entity/Comm_entity.aod @@ -30,7 +30,6 @@ <title>Medium</title> <mandatory v="true" /> <possibleItemsProcess>%aditoprj%/entity/Comm_entity/entityfields/medium_id/possibleItemsProcess.js</possibleItemsProcess> - <valueProcess>%aditoprj%/entity/Comm_entity/entityfields/medium_id/valueProcess.js</valueProcess> </entityField> <entityField> <name>RELATION_ID</name> diff --git a/entity/Comm_entity/entityfields/medium_id/valueProcess.js b/entity/Comm_entity/entityfields/medium_id/valueProcess.js deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/entity/Offer_entity/Offer_entity.aod b/entity/Offer_entity/Offer_entity.aod index 9cc12f720221706a63168933678366a516c9167a..94aa6abcb6373b3e53176a3c760ab13801f0d32d 100644 --- a/entity/Offer_entity/Offer_entity.aod +++ b/entity/Offer_entity/Offer_entity.aod @@ -73,7 +73,7 @@ <name>SALESPROJECT_ID</name> <title>Salesproject</title> <linkedContext>Salesproject_context</linkedContext> - <mandatory v="true" /> + <mandatoryProcess>%aditoprj%/entity/Offer_entity/entityfields/salesproject_id/mandatoryProcess.js</mandatoryProcess> <outgoingField>OfferSalesproject_dfo</outgoingField> <state>INVISIBLE</state> <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/salesproject_id/stateProcess.js</stateProcess> diff --git a/entity/Offer_entity/entityfields/salesproject_id/mandatoryProcess.js b/entity/Offer_entity/entityfields/salesproject_id/mandatoryProcess.js new file mode 100644 index 0000000000000000000000000000000000000000..55c7c33b4f1bd15f6744b7898672d62723e99106 --- /dev/null +++ b/entity/Offer_entity/entityfields/salesproject_id/mandatoryProcess.js @@ -0,0 +1,9 @@ +import("system.vars"); +import("system.result"); +import("Relation_lib"); + +var type = RelationUtils.getRelationType(vars.get("$field.RELATION_ID"), vars.get("$field.RELATION_PERS_ID"), vars.get("$field.RELATION_ORG_ID")); + +result.string(type != 2); + + diff --git a/entity/Offeritem_entity/recordcontainers/db/onDBInsert.js b/entity/Offeritem_entity/recordcontainers/db/onDBInsert.js index 33f35dd3c95aca115048ab046723af2d0ef049ed..2b35ec3e2b15707bb4691928c56b0d8ab569a3d4 100644 --- a/entity/Offeritem_entity/recordcontainers/db/onDBInsert.js +++ b/entity/Offeritem_entity/recordcontainers/db/onDBInsert.js @@ -23,5 +23,4 @@ if(oid != "") db.updateData("OFFER", cols, null, vals, SqlCondition.equals("OFFER.OFFERID", oid, "1 = 2")); - neon.refresh(); } \ No newline at end of file diff --git a/entity/Relation_entity/entityfields/relationtype/valueProcess.js b/entity/Relation_entity/entityfields/relationtype/valueProcess.js index d7e96ebf1347ad6eb152a15c0072fd68dc149c19..fe76276e3d1fbf0db17bbe87fe2cf9cdab05d456 100644 --- a/entity/Relation_entity/entityfields/relationtype/valueProcess.js +++ b/entity/Relation_entity/entityfields/relationtype/valueProcess.js @@ -2,4 +2,4 @@ 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 +result.object(RelationUtils.getRelationType(vars.get("$field.RELATIONID"), vars.get("$field.PERS_ID"), vars.get("$field.ORG_ID"))); \ No newline at end of file diff --git a/entity/SalesprojectMember_entity/SalesprojectMember_entity.aod b/entity/SalesprojectMember_entity/SalesprojectMember_entity.aod index c93b59eb9895ea879c0c6b5e6c8d862f87c37061..e237a622216a6d1237b7f016b16662de5266a143 100644 --- a/entity/SalesprojectMember_entity/SalesprojectMember_entity.aod +++ b/entity/SalesprojectMember_entity/SalesprojectMember_entity.aod @@ -110,7 +110,7 @@ <children> <entityParameter> <name>RelationId_param</name> - <code>%aditoprj%/entity/SalesprojectMember_entity/entityfields/perssalesprojectmember_dfo/children/relationid_param/code.js</code> + <code>%aditoprj%/entity/SalesprojectMember_entity/entityfields/salesprojectmemberpers_dfo/children/relationid_param/code.js</code> </entityParameter> </children> </entityOutgoingField> diff --git a/entity/SalesprojectMember_entity/entityfields/perssalesprojectmember_dfo/children/relationid_param/code.js b/entity/SalesprojectMember_entity/entityfields/salesprojectmemberpers_dfo/children/relationid_param/code.js similarity index 100% rename from entity/SalesprojectMember_entity/entityfields/perssalesprojectmember_dfo/children/relationid_param/code.js rename to entity/SalesprojectMember_entity/entityfields/salesprojectmemberpers_dfo/children/relationid_param/code.js diff --git a/entity/Task_entity/Task_entity.aod b/entity/Task_entity/Task_entity.aod index 837d6c806ecc55860723385587be10b68b580921..33485020c37a5540a8628dd2feb4bb24066371f4 100644 --- a/entity/Task_entity/Task_entity.aod +++ b/entity/Task_entity/Task_entity.aod @@ -172,7 +172,6 @@ <name>db</name> <alias>Data_alias</alias> <orderClauseProcess>%aditoprj%/entity/Task_entity/recordcontainers/db/orderClauseProcess.js</orderClauseProcess> - <onDBInsert>%aditoprj%/entity/Task_entity/recordcontainers/db/onDBInsert.js</onDBInsert> <linkInformation> <linkInformation> <name>47e1b4a5-6901-48b0-85ba-bec39b86a2d7</name> diff --git a/entity/Task_entity/recordcontainers/db/onDBInsert.js b/entity/Task_entity/recordcontainers/db/onDBInsert.js deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/others/db_changes/data_alias/data/example_product/PRODUCT_42154311.xml b/others/db_changes/data_alias/data/example_product/PRODUCT_42154311.xml index a3a1fbf44b07c29e5cbf95a4df577db3faefd8f0..8172e3f1163ab4e925e0dd941b86739fc1989f9b 100644 --- a/others/db_changes/data_alias/data/example_product/PRODUCT_42154311.xml +++ b/others/db_changes/data_alias/data/example_product/PRODUCT_42154311.xml @@ -146,16 +146,6 @@ <column name="USER_NEW" value="Admin"/> <column name="DATE_NEW" valueDate="2018-11-12T14:35:49"/> </insert> - <insert tableName="PROD2PROD"> - <column name="PROD2PRODID" value="a58d73e4-8e5a-4b96-9d39-2a178736bb31"/> - <column name="OPTIONAL" valueNumeric="0"/> - <column name="TAKEPRICE" valueNumeric="0"/> - <column name="QUANTITY" valueNumeric="1.00"/> - <column name="SOURCE_ID" value="6e52e636-284d-454b-978c-8f58844c5c5b"/> - <column name="DEST_ID" value="368aa1c0-b802-4dea-844e-e61bf85a03c9"/> - <column name="USER_NEW" value="Admin"/> - <column name="DATE_NEW" valueDate="2018-11-12T14:35:33"/> - </insert> <insert tableName="PROD2PROD"> <column name="PROD2PRODID" value="752b7549-703f-45de-a7d8-b0a0602715c0"/> <column name="OPTIONAL" valueNumeric="0"/> diff --git a/process/Relation_lib/process.js b/process/Relation_lib/process.js index dc3610977d1b5c2f68bca03c6c55b654c9d906a8..e3dac3e9360959c422e934ec837b82823c9c6c42 100644 --- a/process/Relation_lib/process.js +++ b/process/Relation_lib/process.js @@ -1,3 +1,4 @@ +import("system.neon"); import("system.vars"); import("system.result"); import("system.db"); @@ -12,6 +13,43 @@ import("Context_lib"); */ function RelationUtils() {} +/** + * Get the type of relation. <br> + * In recordstate NEW or EDIT it loads the pers- / orgid from the db.<br> + * But in the other states it uses the values pPersId, pOrgId directly (for performance).<br> + * <br> + * It only checks if pPersId / pOrgId are not empty. <br> + * Based on which parameter is empty / not empty it return s the type of the relation. <br> + * <br> + * !!It does not check if the pers / org ids really exist!! <br> + * !!And it does not check if really any relation with this pers / org ids exist!! <br> + * <br> + * <br> + * It is meant to be used by entitys, where you can load pers and org with the DataRecord. <br> + * This saves an extra select from RELATION. <br> + * <br> + * <br> + * @param {String} pRelationId + * @param {String} pPersId selected from the RELATION table + * @param {String} pOrgId selected from the RELATION table + * <br> + * @return {Integer} <br>0 if both ids are empty <br> + * 1 if organisation <br> + * 2 if privat person <br> + * 3 if person of an organisation <br> + */ +RelationUtils.getRelationType = function(pRelationId, pPersId, pOrgId) +{ + if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) + { + return RelationUtils.getRelationTypeByRelation(pRelationId); + } + else + { + return RelationUtils.getRelationTypeByPersOrg(pPersId, pOrgId); + } +} + /** * get the type of relation for a relationId <br> * If you already have persId and orgId from the RELATION table, use getRelationTypeByPersOrg() <br>