From 555c3e7557ef7f52939d9f873e3463e204050289 Mon Sep 17 00:00:00 2001 From: Nico Bugl <n.bugl@adito.de> Date: Fri, 7 Jun 2019 11:38:10 +0200 Subject: [PATCH] =?UTF-8?q?Verkn=C3=BCpfung=20zu=20Salesproject=20hinzugef?= =?UTF-8?q?=C3=BCgt,=20Fehler=20behoben,=20--=20im=20Offer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../children/newoffer/onActionProcess.js | 2 +- .../entityfields/newoffer/onActionProcess.js | 2 +- entity/Context_entity/Context_entity.aod | 4 + .../recordcontainers/jdito/contentProcess.js | 4 +- entity/Object_entity/Object_entity.aod | 76 ++++++++++++---- .../children/contactid_param/valueProcess.js | 3 + .../children/contactid_param/valueProcess.js | 3 + .../children/contactid_param/valueProcess.js | 3 + .../children/contactid_param/valueProcess.js | 3 + .../children/contactid_param/valueProcess.js | 3 + .../recordcontainers/jdito/contentProcess.js | 6 +- entity/Offer_entity/Offer_entity.aod | 91 ++++++++++++------- .../contact_id/displayValueProcess.js | 12 +-- .../contact_id/documentation.adoc | 18 ++-- .../contact_id/linkedContextProcess.js | 8 +- .../entityfields/contact_id/onValueChange.js | 42 +++++---- .../entityfields/contact_id/stateProcess.js | 10 +- .../entityfields/contact_id/valueProcess.js | 56 ++++++------ .../children/whitelist/valueProcess.js | 4 + .../entityfields/copyoffer/onActionProcess.js | 5 +- .../linkage/displayValueProcess.js | 17 ---- .../entityfields/linkage/valueProcess.js | 7 -- .../possibleconnectiontypes/valueProcess.js | 5 + .../newofferversion/onActionProcess.js | 3 +- .../object_rowid/displayValueProcess.js | 2 +- .../mandatoryProcess.js | 0 .../{linkage => object_rowid}/stateProcess.js | 0 .../object_type/mandatoryProcess.js | 7 ++ .../entityfields/object_type/valueProcess.js | 19 +++- .../children/contactid_param/valueProcess.js | 10 ++ .../objecttype_param/valueProcess.js} | 3 +- .../possibleconnectiontypes/valueProcess.js | 3 + .../entityfields/newoffer/onActionProcess.js | 2 +- .../entityfields/newoffer/onActionProcess.js | 2 +- .../entityfields/newoffer/onActionProcess.js | 3 +- .../entityfields/newoffer/onActionProcess.js | 2 +- .../_____LANGUAGE_EXTRA.aod | 9 +- .../_____LANGUAGE_de/_____LANGUAGE_de.aod | 4 + .../_____LANGUAGE_en/_____LANGUAGE_en.aod | 9 +- neonView/OfferEdit_view/OfferEdit_view.aod | 12 ++- process/Context_lib/process.js | 29 +++++- process/Offer_lib/process.js | 23 +++-- 42 files changed, 347 insertions(+), 179 deletions(-) create mode 100644 entity/Object_entity/entityfields/contracts/children/contactid_param/valueProcess.js create mode 100644 entity/Object_entity/entityfields/offers/children/contactid_param/valueProcess.js create mode 100644 entity/Object_entity/entityfields/orders/children/contactid_param/valueProcess.js create mode 100644 entity/Object_entity/entityfields/persons/children/contactid_param/valueProcess.js create mode 100644 entity/Object_entity/entityfields/salesprojects/children/contactid_param/valueProcess.js create mode 100644 entity/Offer_entity/entityfields/contexts/children/whitelist/valueProcess.js delete mode 100644 entity/Offer_entity/entityfields/linkage/displayValueProcess.js delete mode 100644 entity/Offer_entity/entityfields/linkage/valueProcess.js create mode 100644 entity/Offer_entity/entityfields/links/children/possibleconnectiontypes/valueProcess.js rename entity/Offer_entity/entityfields/{linkage => object_rowid}/mandatoryProcess.js (100%) rename entity/Offer_entity/entityfields/{linkage => object_rowid}/stateProcess.js (100%) create mode 100644 entity/Offer_entity/entityfields/object_type/mandatoryProcess.js create mode 100644 entity/Offer_entity/entityfields/objects/children/contactid_param/valueProcess.js rename entity/Offer_entity/entityfields/{object_rowid/titleProcess.js => objects/children/objecttype_param/valueProcess.js} (95%) create mode 100644 entity/Offer_entity/entityfields/possibleconnectiontypes/valueProcess.js diff --git a/entity/360Degree_entity/entityfields/newmodule/children/newoffer/onActionProcess.js b/entity/360Degree_entity/entityfields/newmodule/children/newoffer/onActionProcess.js index 0be1b35b78..69da5ef801 100644 --- a/entity/360Degree_entity/entityfields/newmodule/children/newoffer/onActionProcess.js +++ b/entity/360Degree_entity/entityfields/newmodule/children/newoffer/onActionProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("Offer_lib"); -OfferUtils.createNewOffer(null, vars.getString("$param.ObjectRowId_param")); \ No newline at end of file +OfferUtils.createNewOffer(null, null, vars.getString("$param.ObjectRowId_param")); \ No newline at end of file diff --git a/entity/Activity_entity/entityfields/newoffer/onActionProcess.js b/entity/Activity_entity/entityfields/newoffer/onActionProcess.js index c8ece29b25..09323bf30c 100644 --- a/entity/Activity_entity/entityfields/newoffer/onActionProcess.js +++ b/entity/Activity_entity/entityfields/newoffer/onActionProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("Offer_lib"); -OfferUtils.createNewOffer(null, vars.getString("$field.ACTIVITYID")); \ No newline at end of file +OfferUtils.createNewOffer(null, null, vars.getString("$field.ACTIVITYID")); \ No newline at end of file diff --git a/entity/Context_entity/Context_entity.aod b/entity/Context_entity/Context_entity.aod index c1134c2e5f..04bc3298a3 100644 --- a/entity/Context_entity/Context_entity.aod +++ b/entity/Context_entity/Context_entity.aod @@ -124,6 +124,10 @@ <expose v="true" /> <description>PARAMETER</description> </entityParameter> + <entityParameter> + <name>Whitelist</name> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <jDitoRecordContainer> diff --git a/entity/Context_entity/recordcontainers/jdito/contentProcess.js b/entity/Context_entity/recordcontainers/jdito/contentProcess.js index 29391c9023..17ad5303c6 100644 --- a/entity/Context_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Context_entity/recordcontainers/jdito/contentProcess.js @@ -1,3 +1,4 @@ +import("system.logging"); import("system.vars"); import("system.result"); import("Context_lib"); @@ -7,5 +8,6 @@ if (excludeContexts) excludeContexts = JSON.parse(excludeContexts); var filterContexts = !(vars.exists("$param.GetAllContexts_param") && vars.get("$param.GetAllContexts_param") == "true"); var useExclusives = vars.exists("$param.UseExclusives_param") && vars.get("$param.UseExclusives_param") == "true"; +var whitelist = vars.exists("$param.Whitelist") && vars.get("$param.Whitelist") ? JSON.parse(vars.get("$param.Whitelist")) : undefined; -result.object(ContextUtils.getContexts(filterContexts, excludeContexts, useExclusives)); \ No newline at end of file +result.object(ContextUtils.getContexts(filterContexts, excludeContexts, useExclusives, whitelist)); \ No newline at end of file diff --git a/entity/Object_entity/Object_entity.aod b/entity/Object_entity/Object_entity.aod index 2a5bcd1a98..e504fb8b24 100644 --- a/entity/Object_entity/Object_entity.aod +++ b/entity/Object_entity/Object_entity.aod @@ -53,12 +53,6 @@ <fieldName>Objects</fieldName> <isConsumer v="false" /> </entityDependency> - <entityDependency> - <name>f6bb8beb-dbcb-4871-9c50-d2399d569fdb</name> - <entityName>Offer_entity</entityName> - <fieldName>Objects</fieldName> - <isConsumer v="false" /> - </entityDependency> <entityDependency> <name>8834387f-acf8-4d9f-80ec-45425622a3dd</name> <entityName>Competition_entity</entityName> @@ -83,6 +77,10 @@ <name>ExcludedObjectIds_param</name> <expose v="false" /> </entityParameter> + <entityParameter> + <name>ContactId_param</name> + <expose v="false" /> + </entityParameter> </children> </entityProvider> <entityConsumer> @@ -92,12 +90,12 @@ <entityName>Organisation_entity</entityName> <fieldName>#PROVIDER</fieldName> </dependency> - <children> - <entityParameter> - <name>ExcludedContactIds_param</name> - <valueProcess>%aditoprj%/entity/Object_entity/entityfields/organisations/children/excludedcontactids_param/valueProcess.js</valueProcess> - </entityParameter> - </children> + <children> + <entityParameter> + <name>ExcludedContactIds_param</name> + <valueProcess>%aditoprj%/entity/Object_entity/entityfields/organisations/children/excludedcontactids_param/valueProcess.js</valueProcess> + </entityParameter> + </children> </entityConsumer> <entityConsumer> <name>Persons</name> @@ -106,12 +104,16 @@ <entityName>Person_entity</entityName> <fieldName>#PROVIDER</fieldName> </dependency> - <children> - <entityParameter> - <name>ExcludedContactIds_param</name> - <valueProcess>%aditoprj%/entity/Object_entity/entityfields/persons/children/excludedcontactids_param/valueProcess.js</valueProcess> - </entityParameter> - </children> + <children> + <entityParameter> + <name>ExcludedContactIds_param</name> + <valueProcess>%aditoprj%/entity/Object_entity/entityfields/persons/children/excludedcontactids_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>ContactId_param</name> + <valueProcess>%aditoprj%/entity/Object_entity/entityfields/persons/children/contactid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> </entityConsumer> <entityConsumer> <name>Offers</name> @@ -120,6 +122,12 @@ <entityName>Offer_entity</entityName> <fieldName>#PROVIDER</fieldName> </dependency> + <children> + <entityParameter> + <name>ContactId_param</name> + <valueProcess>%aditoprj%/entity/Object_entity/entityfields/offers/children/contactid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> </entityConsumer> <entityConsumer> <name>Orders</name> @@ -128,6 +136,12 @@ <entityName>Order_entity</entityName> <fieldName>#PROVIDER</fieldName> </dependency> + <children> + <entityParameter> + <name>ContactId_param</name> + <valueProcess>%aditoprj%/entity/Object_entity/entityfields/orders/children/contactid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> </entityConsumer> <entityConsumer> <name>Products</name> @@ -144,6 +158,12 @@ <entityName>Contract_entity</entityName> <fieldName>#PROVIDER</fieldName> </dependency> + <children> + <entityParameter> + <name>ContactId_param</name> + <valueProcess>%aditoprj%/entity/Object_entity/entityfields/contracts/children/contactid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> </entityConsumer> <entityConsumer> <name>Salesprojects</name> @@ -152,6 +172,12 @@ <entityName>Salesproject_entity</entityName> <fieldName>#PROVIDER</fieldName> </dependency> + <children> + <entityParameter> + <name>ContactId_param</name> + <valueProcess>%aditoprj%/entity/Object_entity/entityfields/salesprojects/children/contactid_param/valueProcess.js</valueProcess> + </entityParameter> + </children> </entityConsumer> <entityParameter> <name>ExcludedObjectIds_param</name> @@ -168,6 +194,12 @@ <fieldName>Objects</fieldName> <isConsumer v="false" /> </entityDependency> + <entityDependency> + <name>e93b8c8f-2575-4669-9e45-48d8382444ab</name> + <entityName>Offer_entity</entityName> + <fieldName>Objects</fieldName> + <isConsumer v="false" /> + </entityDependency> </dependencies> <children> <entityParameter> @@ -180,6 +212,10 @@ <triggerRecalculation v="true" /> <mandatory v="true" /> </entityParameter> + <entityParameter> + <name>ContactId_param</name> + <expose v="true" /> + </entityParameter> </children> </entityProvider> <entityConsumer> @@ -198,6 +234,10 @@ <fieldName>#PROVIDER</fieldName> </dependency> </entityConsumer> + <entityParameter> + <name>ContactId_param</name> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <jDitoRecordContainer> diff --git a/entity/Object_entity/entityfields/contracts/children/contactid_param/valueProcess.js b/entity/Object_entity/entityfields/contracts/children/contactid_param/valueProcess.js new file mode 100644 index 0000000000..ca088c7645 --- /dev/null +++ b/entity/Object_entity/entityfields/contracts/children/contactid_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.vars"); +import("system.result"); +result.string(vars.get("$param.ContactId_param")); \ No newline at end of file diff --git a/entity/Object_entity/entityfields/offers/children/contactid_param/valueProcess.js b/entity/Object_entity/entityfields/offers/children/contactid_param/valueProcess.js new file mode 100644 index 0000000000..ca088c7645 --- /dev/null +++ b/entity/Object_entity/entityfields/offers/children/contactid_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.vars"); +import("system.result"); +result.string(vars.get("$param.ContactId_param")); \ No newline at end of file diff --git a/entity/Object_entity/entityfields/orders/children/contactid_param/valueProcess.js b/entity/Object_entity/entityfields/orders/children/contactid_param/valueProcess.js new file mode 100644 index 0000000000..ca088c7645 --- /dev/null +++ b/entity/Object_entity/entityfields/orders/children/contactid_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.vars"); +import("system.result"); +result.string(vars.get("$param.ContactId_param")); \ No newline at end of file diff --git a/entity/Object_entity/entityfields/persons/children/contactid_param/valueProcess.js b/entity/Object_entity/entityfields/persons/children/contactid_param/valueProcess.js new file mode 100644 index 0000000000..ca088c7645 --- /dev/null +++ b/entity/Object_entity/entityfields/persons/children/contactid_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.vars"); +import("system.result"); +result.string(vars.get("$param.ContactId_param")); \ No newline at end of file diff --git a/entity/Object_entity/entityfields/salesprojects/children/contactid_param/valueProcess.js b/entity/Object_entity/entityfields/salesprojects/children/contactid_param/valueProcess.js new file mode 100644 index 0000000000..ca088c7645 --- /dev/null +++ b/entity/Object_entity/entityfields/salesprojects/children/contactid_param/valueProcess.js @@ -0,0 +1,3 @@ +import("system.vars"); +import("system.result"); +result.string(vars.get("$param.ContactId_param")); \ No newline at end of file diff --git a/entity/Object_entity/recordcontainers/jdito/contentProcess.js b/entity/Object_entity/recordcontainers/jdito/contentProcess.js index 932e731251..be53d61350 100644 --- a/entity/Object_entity/recordcontainers/jdito/contentProcess.js +++ b/entity/Object_entity/recordcontainers/jdito/contentProcess.js @@ -13,7 +13,11 @@ if (vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param" if (vars.exists("$param.ExcludedObjectIds_param") && vars.get("$param.ExcludedObjectIds_param")) excludedIds = JSON.parse(vars.getString("$param.ExcludedObjectIds_param")); - result.object(db.table(ContextUtils.getContextDataSql(vars.get("$param.ObjectType_param"), undefined, false, undefined, false, excludedIds))) + var contactId + if (vars.exists("$param.ContactId") && vars.get("$param.ContactId")) + contactId = vars.get("$param.ContactId"); + + result.object(db.table(ContextUtils.getContextDataSql(vars.get("$param.ObjectType_param"), contactId, false, undefined, false, excludedIds))) } else { diff --git a/entity/Offer_entity/Offer_entity.aod b/entity/Offer_entity/Offer_entity.aod index 9f62d333ec..9efcf06a3b 100644 --- a/entity/Offer_entity/Offer_entity.aod +++ b/entity/Offer_entity/Offer_entity.aod @@ -57,23 +57,6 @@ <contentType>NUMBER</contentType> <displayValueProcess>%aditoprj%/entity/Offer_entity/entityfields/probability/displayValueProcess.js</displayValueProcess> </entityField> - <entityField> - <name>CONTACT_ID</name> - <documentation>%aditoprj%/entity/Offer_entity/entityfields/contact_id/documentation.adoc</documentation> - <title>Connection</title> - <consumer>AnyContacts</consumer> - <linkedContextProcess>%aditoprj%/entity/Offer_entity/entityfields/contact_id/linkedContextProcess.js</linkedContextProcess> - <mandatory v="true" /> - <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/contact_id/stateProcess.js</stateProcess> - <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/contact_id/valueProcess.js</valueProcess> - <displayValueProcess>%aditoprj%/entity/Offer_entity/entityfields/contact_id/displayValueProcess.js</displayValueProcess> - <onValueChange>%aditoprj%/entity/Offer_entity/entityfields/contact_id/onValueChange.js</onValueChange> - <onValueChangeTypes> - <element>MASK</element> - <element>PROCESS</element> - <element>PROCESS_SETVALUE</element> - </onValueChangeTypes> - </entityField> <entityField> <name>STATUS</name> <title>Status</title> @@ -443,6 +426,10 @@ <name>OfferVersnr_param</name> <expose v="false" /> </entityParameter> + <entityParameter> + <name>PossibleConnectionTypes</name> + <expose v="false" /> + </entityParameter> </children> </entityProvider> <entityParameter> @@ -646,16 +633,21 @@ </entityField> <entityField> <name>OBJECT_ROWID</name> + <title>Connection</title> <consumer>Objects</consumer> <linkedContextProcess>%aditoprj%/entity/Offer_entity/entityfields/object_rowid/linkedContextProcess.js</linkedContextProcess> + <mandatoryProcess>%aditoprj%/entity/Offer_entity/entityfields/object_rowid/mandatoryProcess.js</mandatoryProcess> <state>AUTO</state> - <titleProcess>%aditoprj%/entity/Offer_entity/entityfields/object_rowid/titleProcess.js</titleProcess> + <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/object_rowid/stateProcess.js</stateProcess> <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/object_rowid/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Offer_entity/entityfields/object_rowid/displayValueProcess.js</displayValueProcess> </entityField> <entityField> <name>OBJECT_TYPE</name> + <title>Connection Type</title> <consumer>Contexts</consumer> + <mandatoryProcess>%aditoprj%/entity/Offer_entity/entityfields/object_type/mandatoryProcess.js</mandatoryProcess> + <state>INVISIBLE</state> <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/object_type/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Offer_entity/entityfields/object_type/displayValueProcess.js</displayValueProcess> </entityField> @@ -664,8 +656,19 @@ <dependency> <name>dependency</name> <entityName>Object_entity</entityName> - <fieldName>AllObjects</fieldName> + <fieldName>FilteredObjects</fieldName> </dependency> + <children> + <entityParameter> + <name>ObjectType_param</name> + <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/objects/children/objecttype_param/valueProcess.js</valueProcess> + </entityParameter> + <entityParameter> + <name>ContactId_param</name> + <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/objects/children/contactid_param/valueProcess.js</valueProcess> + <triggerRecalculation v="true" /> + </entityParameter> + </children> </entityConsumer> <entityConsumer> <name>Contexts</name> @@ -674,6 +677,12 @@ <entityName>Context_entity</entityName> <fieldName>Context</fieldName> </dependency> + <children> + <entityParameter> + <name>Whitelist</name> + <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/contexts/children/whitelist/valueProcess.js</valueProcess> + </entityParameter> + </children> </entityConsumer> <entityProvider> <name>Links</name> @@ -735,6 +744,11 @@ <name>OfferVersnr_param</name> <expose v="false" /> </entityParameter> + <entityParameter> + <name>PossibleConnectionTypes</name> + <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/links/children/possibleconnectiontypes/valueProcess.js</valueProcess> + <expose v="false" /> + </entityParameter> </children> </entityProvider> <entityParameter> @@ -819,15 +833,6 @@ </entityParameter> </children> </entityConsumer> - <entityField> - <name>LINKAGE</name> - <title>Additional link</title> - <consumer>Salesprojects</consumer> - <mandatoryProcess>%aditoprj%/entity/Offer_entity/entityfields/linkage/mandatoryProcess.js</mandatoryProcess> - <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/linkage/stateProcess.js</stateProcess> - <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/linkage/valueProcess.js</valueProcess> - <displayValueProcess>%aditoprj%/entity/Offer_entity/entityfields/linkage/displayValueProcess.js</displayValueProcess> - </entityField> <entityConsumer> <name>Salesprojects</name> <dependency> @@ -842,6 +847,28 @@ </entityParameter> </children> </entityConsumer> + <entityField> + <name>CONTACT_ID</name> + <documentation>%aditoprj%/entity/Offer_entity/entityfields/contact_id/documentation.adoc</documentation> + <title>Assignment</title> + <consumer>AnyContacts</consumer> + <linkedContextProcess>%aditoprj%/entity/Offer_entity/entityfields/contact_id/linkedContextProcess.js</linkedContextProcess> + <mandatory v="true" /> + <stateProcess>%aditoprj%/entity/Offer_entity/entityfields/contact_id/stateProcess.js</stateProcess> + <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/contact_id/valueProcess.js</valueProcess> + <displayValueProcess>%aditoprj%/entity/Offer_entity/entityfields/contact_id/displayValueProcess.js</displayValueProcess> + <onValueChange>%aditoprj%/entity/Offer_entity/entityfields/contact_id/onValueChange.js</onValueChange> + <onValueChangeTypes> + <element>MASK</element> + <element>PROCESS</element> + <element>PROCESS_SETVALUE</element> + </onValueChangeTypes> + </entityField> + <entityParameter> + <name>PossibleConnectionTypes</name> + <valueProcess>%aditoprj%/entity/Offer_entity/entityfields/possibleconnectiontypes/valueProcess.js</valueProcess> + <expose v="true" /> + </entityParameter> </entityFields> <recordContainers> <dbRecordContainer> @@ -921,10 +948,6 @@ <name>VERSNR.value</name> <recordfield>OFFER.VERSNR</recordfield> </dbRecordFieldMapping> - <dbRecordFieldMapping> - <name>CONTACT_ID.value</name> - <recordfield>OFFER.CONTACT_ID</recordfield> - </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTACT_ORG_ID.value</name> <recordfield>CONTACT.ORGANISATION_ID</recordfield> @@ -1005,6 +1028,10 @@ <name>OBJECT_ROWID.displayValue</name> <expression>%aditoprj%/entity/Offer_entity/recordcontainers/db/recordfieldmappings/object_rowid.displayvalue/expression.js</expression> </dbRecordFieldMapping> + <dbRecordFieldMapping> + <name>CONTACT_ID.value</name> + <recordfield>OFFER.CONTACT_ID</recordfield> + </dbRecordFieldMapping> </recordFieldMappings> </dbRecordContainer> </recordContainers> diff --git a/entity/Offer_entity/entityfields/contact_id/displayValueProcess.js b/entity/Offer_entity/entityfields/contact_id/displayValueProcess.js index 08ad146eee..d8f47a34a6 100644 --- a/entity/Offer_entity/entityfields/contact_id/displayValueProcess.js +++ b/entity/Offer_entity/entityfields/contact_id/displayValueProcess.js @@ -1,7 +1,7 @@ -import("system.result"); -import("system.vars"); -import("Contact_lib"); -import("system.neon"); - - +import("system.result"); +import("system.vars"); +import("Contact_lib"); +import("system.neon"); + + result.string(ContactUtils.getFullTitleByContactId(vars.getString("$field.CONTACT_ID"))); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/contact_id/documentation.adoc b/entity/Offer_entity/entityfields/contact_id/documentation.adoc index f8989a2242..5812dd624d 100644 --- a/entity/Offer_entity/entityfields/contact_id/documentation.adoc +++ b/entity/Offer_entity/entityfields/contact_id/documentation.adoc @@ -1,10 +1,10 @@ -= CONTACT_ID -:hardbreaks: - -Over this field the company or contact person of customer is linked. - -== onValueChange - -If set in the selected company or contact person, the following field value are taken over: - += CONTACT_ID +:hardbreaks: + +Over this field the company or contact person of customer is linked. + +== onValueChange + +If set in the selected company or contact person, the following field value are taken over: + * LANGUAGE \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/contact_id/linkedContextProcess.js b/entity/Offer_entity/entityfields/contact_id/linkedContextProcess.js index 2e504d63e3..c6e221c744 100644 --- a/entity/Offer_entity/entityfields/contact_id/linkedContextProcess.js +++ b/entity/Offer_entity/entityfields/contact_id/linkedContextProcess.js @@ -1,5 +1,5 @@ -import("system.vars"); -import("system.result"); -import("Contact_lib"); - +import("system.vars"); +import("system.result"); +import("Contact_lib"); + result.string(ContactUtils.getContextByContactId(vars.getString("$field.CONTACT_ID"))); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/contact_id/onValueChange.js b/entity/Offer_entity/entityfields/contact_id/onValueChange.js index 21017ee1ee..2aab8d05a1 100644 --- a/entity/Offer_entity/entityfields/contact_id/onValueChange.js +++ b/entity/Offer_entity/entityfields/contact_id/onValueChange.js @@ -1,19 +1,25 @@ -import("system.neon"); -import("system.vars"); -import("system.db"); -import("Util_lib"); -import("Entity_lib"); -import("Contact_lib"); - -var contactid = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.CONTACT_ID")); -if(contactid != "") -{ - //Language Preset - var relData = db.array(db.ROW, "select LANGUAGE from CONTACT where CONTACTID = '" + contactid + "'"); - if(relData[0] != "") - neon.setFieldValue("field.LANGUAGE", relData[0]); - - // set $field.CONTATCT_ORG_ID per contactid - var orgid = ContactUtils.getPersOrgIds(contactid); - neon.setFieldValue("$field.CONTACT_ORG_ID", orgid[2]); +import("system.neon"); +import("system.vars"); +import("system.db"); +import("Util_lib"); +import("Entity_lib"); +import("Contact_lib"); + +var contactid = ProcessHandlingUtils.getOnValidationValue(vars.get("$field.CONTACT_ID")); +if(contactid != "") +{ + //Language Preset + var relData = db.array(db.ROW, "select LANGUAGE from CONTACT where CONTACTID = '" + contactid + "'"); + if(relData[0] != "") + neon.setFieldValue("field.LANGUAGE", relData[0]); + + // set $field.CONTATCT_ORG_ID per contactid + var orgid = ContactUtils.getPersOrgIds(contactid); + neon.setFieldValue("$field.CONTACT_ORG_ID", orgid[2]); +} +else +{ + neon.setFieldValue("$field.CONTACT_ORG_ID", ""); + neon.setFieldValue("$field.LANGUAGE", ""); + neon.setFieldValue("$field.OBJECT_ROWID", ""); } \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/contact_id/stateProcess.js b/entity/Offer_entity/entityfields/contact_id/stateProcess.js index dc6fd1b10e..7631bbeeaf 100644 --- a/entity/Offer_entity/entityfields/contact_id/stateProcess.js +++ b/entity/Offer_entity/entityfields/contact_id/stateProcess.js @@ -1,6 +1,6 @@ -import("system.result"); -import("system.vars"); -import("system.neon"); - -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) +import("system.result"); +import("system.vars"); +import("system.neon"); + +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) result.string(neon.COMPONENTSTATE_READONLY); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/contact_id/valueProcess.js b/entity/Offer_entity/entityfields/contact_id/valueProcess.js index 3f52c89ca5..6f7346fcc5 100644 --- a/entity/Offer_entity/entityfields/contact_id/valueProcess.js +++ b/entity/Offer_entity/entityfields/contact_id/valueProcess.js @@ -1,28 +1,30 @@ - -import("system.neon"); -import("system.db"); -import("system.result"); -import("system.vars"); -import("Sql_lib"); - -if (vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param")) -{ - var contactid = vars.get("$param.ContactId_param"); - var relData = db.array(db.ROW, "select LANGUAGE from CONTACT where CONTACTID = '" + contactid + "'"); - - if(relData[0] != "") - neon.setFieldValue("field.LANGUAGE", relData[0]); - - result.string(vars.get("$param.ContactId_param")); -} -else if (vars.exists("$param.ObjectRowId_param") && vars.get("$param.ObjectRowId_param")) -{ - var objectType = vars.get("$param.ObjectType_param"); - switch (objectType){ - case "Salesproject": - result.string(db.cell(SqlCondition.begin() - .andPrepareVars("SALESPROJECT.SALESPROJECTID", "$param.ObjectRowId_param") - .buildSql("select CONTACT_ID from SALESPROJECT", "1=2"))); - break; - } +import("system.logging"); +import("system.neon"); +import("system.db"); +import("system.result"); +import("system.vars"); +import("Sql_lib"); +import("Context_lib"); + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +var contactId = ""; +if ((!vars.exists("$param.ContactId_param") || !vars.get("$param.ContactId_param")) + && (vars.exists("$param.ObjectType_param") + && vars.get("$param.ObjectType_param") + && vars.exists("$param.ObjectRowId_param") + && vars.get("$param.ObjectRowId_param"))) +{ + contactId = ContextUtils.getContactId(vars.get("$param.ObjectType_param"), vars.get("$param.ObjectRowId_param")) +} else if (vars.exists("$param.ContactId_param") && vars.get("$param.ContactId_param")) { + contactId = vars.get("$param.ContactId_param"); + +} +if (contactId) +{ + var relData = db.array(db.ROW, "select LANGUAGE from CONTACT where CONTACTID = '" + contactId + "'"); + + if(relData[0] != "") + neon.setFieldValue("field.LANGUAGE", relData[0]); + + result.string(contactId); } \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/contexts/children/whitelist/valueProcess.js b/entity/Offer_entity/entityfields/contexts/children/whitelist/valueProcess.js new file mode 100644 index 0000000000..928bc6a94c --- /dev/null +++ b/entity/Offer_entity/entityfields/contexts/children/whitelist/valueProcess.js @@ -0,0 +1,4 @@ +import("system.vars"); +import("system.result"); + +result.string(vars.get("$param.PossibleConnectionTypes")) \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/copyoffer/onActionProcess.js b/entity/Offer_entity/entityfields/copyoffer/onActionProcess.js index eecb29ab0d..4dc0b8f10a 100644 --- a/entity/Offer_entity/entityfields/copyoffer/onActionProcess.js +++ b/entity/Offer_entity/entityfields/copyoffer/onActionProcess.js @@ -10,9 +10,10 @@ var footer = vars.getString("$field.FOOTER"); var offerId = vars.getString("$field.OFFERID"); var deliveryTerm = vars.getString("$field.DELIVERYTERMS"); var paymentTerm = vars.getString("$field.PAYMENTTERMS"); -var salesprojectId = vars.getString("$field.OBJECT_ROWID"); +var rowId = vars.getString("$field.OBJECT_ROWID"); +var objectType = vars.getString("$field.OBJECT_TYPE"); -OfferUtils.copyOffer(offerId, contactId, language, currency, header, footer, deliveryTerm, paymentTerm, salesprojectId); +OfferUtils.copyOffer(offerId, contactId, language, currency, header, footer, deliveryTerm, paymentTerm, objectType, rowId); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/linkage/displayValueProcess.js b/entity/Offer_entity/entityfields/linkage/displayValueProcess.js deleted file mode 100644 index 7599db7fc3..0000000000 --- a/entity/Offer_entity/entityfields/linkage/displayValueProcess.js +++ /dev/null @@ -1,17 +0,0 @@ -import("Sql_lib"); -import("system.db"); -import("system.vars"); -import("system.result"); -import("Salesproject_lib"); - -if(vars.exists("$param.ObjectRowId_param") && vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectRowId_param") && vars.get("$param.ObjectType_param")) - var objectType = vars.get("$param.ObjectType_param"); -switch (objectType){ - - case "Salesproject": - result.string(db.cell( SqlCondition.begin() - .andPrepare("SALESPROJECT.SALESPROJECTID", vars.get("$field.OBJECT_ROWID")) - .buildSql("select PROJECTTITLE from SALESPROJECT", "1=0"))); - break; - -} diff --git a/entity/Offer_entity/entityfields/linkage/valueProcess.js b/entity/Offer_entity/entityfields/linkage/valueProcess.js deleted file mode 100644 index 37fd0bb103..0000000000 --- a/entity/Offer_entity/entityfields/linkage/valueProcess.js +++ /dev/null @@ -1,7 +0,0 @@ -import("system.result"); -import("system.vars"); - -if (vars.exists("$param.ObjectRowId_param")) -{ - result.string(vars.get("$param.ObjectRowId_param")); -} diff --git a/entity/Offer_entity/entityfields/links/children/possibleconnectiontypes/valueProcess.js b/entity/Offer_entity/entityfields/links/children/possibleconnectiontypes/valueProcess.js new file mode 100644 index 0000000000..4ac5b0e3ef --- /dev/null +++ b/entity/Offer_entity/entityfields/links/children/possibleconnectiontypes/valueProcess.js @@ -0,0 +1,5 @@ +import("system.vars"); +import("system.result"); + +if (vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param")) + result.object([vars.get("$param.ObjectType_param")]); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/newofferversion/onActionProcess.js b/entity/Offer_entity/entityfields/newofferversion/onActionProcess.js index 5087acef8c..66b368d8e0 100644 --- a/entity/Offer_entity/entityfields/newofferversion/onActionProcess.js +++ b/entity/Offer_entity/entityfields/newofferversion/onActionProcess.js @@ -4,7 +4,8 @@ import("Offer_lib"); var params = { "ContactId_param" : vars.get("$field.CONTACT_ID"), - "SalesprojectId_param" : vars.get("$field.OBJECT_ROWID"), + "ObjectType_param" : vars.get("$field.OBJECT_TYPE"), + "ObjectRowId_param" : vars.get("$field.OBJECT_ROWID"), "OfferLanguage_param" : vars.get("$field.LANGUAGE"), "OfferOriginal_Id_param" : vars.get("$field.OFFERID"), "OfferCode_param" : vars.get("$field.OFFERCODE"), diff --git a/entity/Offer_entity/entityfields/object_rowid/displayValueProcess.js b/entity/Offer_entity/entityfields/object_rowid/displayValueProcess.js index 8b080bceea..56d86282f4 100644 --- a/entity/Offer_entity/entityfields/object_rowid/displayValueProcess.js +++ b/entity/Offer_entity/entityfields/object_rowid/displayValueProcess.js @@ -4,7 +4,7 @@ import("system.db"); import("system.result"); import("Context_lib"); -if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$field.OBJECT_ROWID")) { +if(vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) { result.string(""); } else if (vars.exists("$field.OBJECT_TYPE") && vars.get("$field.OBJECT_TYPE")) { result.string(db.cell(ContextUtils.getNameSql(vars.get("$field.OBJECT_TYPE"), vars.get("$field.OBJECT_ROWID")))); diff --git a/entity/Offer_entity/entityfields/linkage/mandatoryProcess.js b/entity/Offer_entity/entityfields/object_rowid/mandatoryProcess.js similarity index 100% rename from entity/Offer_entity/entityfields/linkage/mandatoryProcess.js rename to entity/Offer_entity/entityfields/object_rowid/mandatoryProcess.js diff --git a/entity/Offer_entity/entityfields/linkage/stateProcess.js b/entity/Offer_entity/entityfields/object_rowid/stateProcess.js similarity index 100% rename from entity/Offer_entity/entityfields/linkage/stateProcess.js rename to entity/Offer_entity/entityfields/object_rowid/stateProcess.js diff --git a/entity/Offer_entity/entityfields/object_type/mandatoryProcess.js b/entity/Offer_entity/entityfields/object_type/mandatoryProcess.js new file mode 100644 index 0000000000..4736fe4bfc --- /dev/null +++ b/entity/Offer_entity/entityfields/object_type/mandatoryProcess.js @@ -0,0 +1,7 @@ +import("system.vars"); +import("system.result"); +import("Contact_lib"); + +var type = ContactUtils.getContactType(vars.get("$field.CONTACT_ID"), vars.get("$field.CONTACT_PERSON_ID"), vars.get("$field.CONTACT_ORG_ID")); + +result.string(type != 2); diff --git a/entity/Offer_entity/entityfields/object_type/valueProcess.js b/entity/Offer_entity/entityfields/object_type/valueProcess.js index 18543dfe49..93f98305df 100644 --- a/entity/Offer_entity/entityfields/object_type/valueProcess.js +++ b/entity/Offer_entity/entityfields/object_type/valueProcess.js @@ -1,7 +1,20 @@ +import("system.logging"); +import("system.neon"); import("system.vars"); import("system.result"); import("Context_lib") -if(vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param")) - result.string(vars.get("$param.ObjectType_param")); -else result.string(ContextUtils.getCurrentContextId()) \ No newline at end of file +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && !vars.get("$this.value")) +{ + if (vars.exists("$param.ObjectType_param") && vars.get("$param.ObjectType_param")) + { + result.string(vars.get("$param.ObjectType_param")); + } + else if (vars.exists("$param.PossibleConnectionTypes") && vars.get("$param.PossibleConnectionTypes")) + { + var possible = JSON.parse(vars.getString("$param.PossibleConnectionTypes")); + if (possible.length > 0) + result.string(possible[0]); + } +} + \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/objects/children/contactid_param/valueProcess.js b/entity/Offer_entity/entityfields/objects/children/contactid_param/valueProcess.js new file mode 100644 index 0000000000..22a6e045a3 --- /dev/null +++ b/entity/Offer_entity/entityfields/objects/children/contactid_param/valueProcess.js @@ -0,0 +1,10 @@ +import("system.result"); +import("system.vars"); +import("Contact_lib"); + +if (vars.get("$field.CONTACT_ID")) +{ + var ids = ContactUtils.getPersOrgIds(vars.getString("$field.CONTACT_ID")); + if (ids.length >= 3 && ids[2]) + result.string(ContactUtils.getPersOrgIds(vars.getString("$field.CONTACT_ID"))[2]); +} \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/object_rowid/titleProcess.js b/entity/Offer_entity/entityfields/objects/children/objecttype_param/valueProcess.js similarity index 95% rename from entity/Offer_entity/entityfields/object_rowid/titleProcess.js rename to entity/Offer_entity/entityfields/objects/children/objecttype_param/valueProcess.js index 1bb50e998d..4238ef7d33 100644 --- a/entity/Offer_entity/entityfields/object_rowid/titleProcess.js +++ b/entity/Offer_entity/entityfields/objects/children/objecttype_param/valueProcess.js @@ -1,3 +1,4 @@ -import("system.vars"); import("system.result"); +import("system.vars"); + result.string(vars.get("$field.OBJECT_TYPE")); \ No newline at end of file diff --git a/entity/Offer_entity/entityfields/possibleconnectiontypes/valueProcess.js b/entity/Offer_entity/entityfields/possibleconnectiontypes/valueProcess.js new file mode 100644 index 0000000000..e4878ba3ea --- /dev/null +++ b/entity/Offer_entity/entityfields/possibleconnectiontypes/valueProcess.js @@ -0,0 +1,3 @@ +import("system.result"); + +result.object(["Salesproject"]); \ No newline at end of file diff --git a/entity/Organisation_entity/entityfields/newoffer/onActionProcess.js b/entity/Organisation_entity/entityfields/newoffer/onActionProcess.js index a7172e4cec..e9a1393624 100644 --- a/entity/Organisation_entity/entityfields/newoffer/onActionProcess.js +++ b/entity/Organisation_entity/entityfields/newoffer/onActionProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("Offer_lib"); -OfferUtils.createNewOffer(null, vars.getString("$field.CONTACTID")); \ No newline at end of file +OfferUtils.createNewOffer(null, null, vars.getString("$field.CONTACTID")); \ No newline at end of file diff --git a/entity/Person_entity/entityfields/newoffer/onActionProcess.js b/entity/Person_entity/entityfields/newoffer/onActionProcess.js index a7172e4cec..e9a1393624 100644 --- a/entity/Person_entity/entityfields/newoffer/onActionProcess.js +++ b/entity/Person_entity/entityfields/newoffer/onActionProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("Offer_lib"); -OfferUtils.createNewOffer(null, vars.getString("$field.CONTACTID")); \ No newline at end of file +OfferUtils.createNewOffer(null, null, vars.getString("$field.CONTACTID")); \ No newline at end of file diff --git a/entity/Salesproject_entity/entityfields/newoffer/onActionProcess.js b/entity/Salesproject_entity/entityfields/newoffer/onActionProcess.js index 45f61d0f0e..36d7296f70 100644 --- a/entity/Salesproject_entity/entityfields/newoffer/onActionProcess.js +++ b/entity/Salesproject_entity/entityfields/newoffer/onActionProcess.js @@ -1,4 +1,5 @@ +import("Context_lib"); import("system.vars"); import("Offer_lib"); -OfferUtils.createNewOffer(vars.get("$field.SALESPROJECTID"), vars.get("$field.CONTACT_ID")); \ No newline at end of file +OfferUtils.createNewOffer(ContextUtils.getCurrentContextId(), vars.get("$field.SALESPROJECTID"), vars.get("$field.CONTACT_ID")); \ No newline at end of file diff --git a/entity/Task_entity/entityfields/newoffer/onActionProcess.js b/entity/Task_entity/entityfields/newoffer/onActionProcess.js index 550d39bb7b..63640f70c2 100644 --- a/entity/Task_entity/entityfields/newoffer/onActionProcess.js +++ b/entity/Task_entity/entityfields/newoffer/onActionProcess.js @@ -1,4 +1,4 @@ import("system.vars"); import("Offer_lib"); -OfferUtils.createNewOffer(null, vars.getString("$field.TASKID")); \ No newline at end of file +OfferUtils.createNewOffer(null, null, vars.getString("$field.TASKID")); \ No newline at end of file diff --git a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod index 5ccd168876..6f77e247fb 100644 --- a/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod +++ b/language/_____LANGUAGE_EXTRA/_____LANGUAGE_EXTRA.aod @@ -3645,9 +3645,12 @@ <entry> <key>Kein Weitergeben von privaten Aufgaben möglich!</key> </entry> - <entry> - <key>Search for new Entries</key> - </entry> + <entry> + <key>Search for new Entries</key> + </entry> + <entry> + <key>Additional link</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> <sqlModels> diff --git a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod index ec3daa390c..cbbb0e7e9f 100644 --- a/language/_____LANGUAGE_de/_____LANGUAGE_de.aod +++ b/language/_____LANGUAGE_de/_____LANGUAGE_de.aod @@ -10,6 +10,10 @@ <key>Steps</key> <value>Stufen</value> </entry> + <entry> + <key>Assignment</key> + <value>Zuordnung</value> + </entry> <entry> <key>Project management</key> <value>Projektmanagement</value> diff --git a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod index 9d048042fa..091a3ab179 100644 --- a/language/_____LANGUAGE_en/_____LANGUAGE_en.aod +++ b/language/_____LANGUAGE_en/_____LANGUAGE_en.aod @@ -3694,9 +3694,12 @@ <entry> <key>Kein Weitergeben von privaten Aufgaben möglich!</key> </entry> - <entry> - <key>Search for new Entries</key> - </entry> + <entry> + <key>Search for new Entries</key> + </entry> + <entry> + <key>Additional link</key> + </entry> </keyValueMap> <font name="Dialog" style="0" size="11" /> </language> diff --git a/neonView/OfferEdit_view/OfferEdit_view.aod b/neonView/OfferEdit_view/OfferEdit_view.aod index 9e6b23e56b..3a765ca016 100644 --- a/neonView/OfferEdit_view/OfferEdit_view.aod +++ b/neonView/OfferEdit_view/OfferEdit_view.aod @@ -20,6 +20,14 @@ <name>1b323e80-820d-402a-98d2-f3649ec8e91f</name> <entityField>CONTACT_ID</entityField> </entityFieldLink> + <entityFieldLink> + <name>c96356b6-d18f-4944-af5b-a646faed33c9</name> + <entityField>OBJECT_TYPE</entityField> + </entityFieldLink> + <entityFieldLink> + <name>ff271393-be47-446c-b6b3-6c84dfa881e5</name> + <entityField>OBJECT_ROWID</entityField> + </entityFieldLink> <entityFieldLink> <name>767a9e6e-596b-4903-aa86-7bc0f66cd037</name> <entityField>STATUS</entityField> @@ -40,10 +48,6 @@ <name>7ab3eb65-b713-4251-9eb1-3119432565f5</name> <entityField>LANGUAGE</entityField> </entityFieldLink> - <entityFieldLink> - <name>eb4c5ca2-1e72-4e52-bfd1-505447ed231f</name> - <entityField>LINKAGE</entityField> - </entityFieldLink> <entityFieldLink> <name>7a9b0943-eb06-4b44-a111-ed4e2749da6a</name> <entityField>DELIVERYTERMS</entityField> diff --git a/process/Context_lib/process.js b/process/Context_lib/process.js index 4acb61c1fa..ff5df13479 100644 --- a/process/Context_lib/process.js +++ b/process/Context_lib/process.js @@ -1,3 +1,5 @@ +import("system.logging"); +import("system.db"); import("system.translate"); import("system.project"); import("system.vars"); @@ -85,10 +87,11 @@ ContextUtils.getContextConsumer = function(pContextId) * @param {String[]} [pExclusiveContexts] contextIds that shall not be included (so this is a additional filter to the pFilter param) * @param {Boolean} [pUseExclusives=false] decides whether the items in pExclusiveContexts are excluded (false) or * everything that is not in pExclusiveContexts is excluded (true) + * @param {String[]} [pWhitelist=undefined] only allowed contexts * * @return {String[][]} the contexts [[contextId, contextName, contextTitle], [... ], ...] */ -ContextUtils.getContexts = function(pFilter, pExclusiveContexts, pUseExclusives) +ContextUtils.getContexts = function(pFilter, pExclusiveContexts, pUseExclusives, pWhitelist) { if (pFilter == undefined) pFilter = false; @@ -114,6 +117,13 @@ ContextUtils.getContexts = function(pFilter, pExclusiveContexts, pUseExclusives) return true; }); } + + if (pWhitelist) + { + contexts = contexts.filter(function(pContext) { + return (pWhitelist.indexOf(pContext[0]) >= 0); + }); + } return contexts.map(ContextUtils._contextDataMapping).sort(function(pContext1, pContext2) { @@ -436,6 +446,23 @@ ContextUtils.getNameSql = function(pContextId, pRowId) return "select 1 from person where 1=2"; } +/** + * TODO: !!!temporary function until you can get fields from another Entity!!! + */ +ContextUtils.getContactId = function(pContextId, pRowId) +{ + var selectMap = ContextUtils.getSelectMap () + if (selectMap[pContextId] != undefined && selectMap[pContextId].contactIdField) + { + + return db.cell(SqlCondition.begin().andPrepare(selectMap[pContextId].getFullIdField(), pRowId) + .buildSql("select " + selectMap[pContextId].contactIdField + + " from " + selectMap[pContextId].tableName, "1 = 2")); + } + else + return ""; +} + /** * TODO: !!!temporary function until you can get fields from another Entity!!! */ diff --git a/process/Offer_lib/process.js b/process/Offer_lib/process.js index 91417aabca..d4f7dc14bb 100644 --- a/process/Offer_lib/process.js +++ b/process/Offer_lib/process.js @@ -67,12 +67,15 @@ OfferUtils.isEditable = function(status) { /** * Create a new offer and open the offer context in NEW-mode */ -OfferUtils.createNewOffer = function(pSalesprojectId, pRelationId) +OfferUtils.createNewOffer = function(pContextId, pRowId, pRelationId) { var params = {}; - if (pSalesprojectId) - params["SalesprojectId_param"] = pSalesprojectId; + if (pRowId && pContextId) + { + params["ObjectRowId_param"] = pRowId; + params["ObjectType_param"] = pContextId; + } if (pRelationId) params["ContactId_param"] = pRelationId; @@ -106,8 +109,9 @@ OfferUtils.openOfferReport = function (pOfferID) "VAT", sqlUtil.isNull("VERSNR", "0"), sqlUtil.isNull("OFFERCODE", "0"), - "SALESPROJECT_ID", //12 - "FOOTER" //13 + "OBJECT_TYPE", //12 + "OBJECT_ROWID", //13 + "FOOTER" //14 ]; var offerSql = SqlCondition.begin() @@ -196,7 +200,7 @@ OfferUtils.openOfferReport = function (pOfferID) item[5], //itemposition item[6], //productcode offerData[8], //header - offerData[13], //footer + offerData[14], //footer text.formatDouble(item[9], translate.text("#,##0"), true), //quantity text.formatDouble(item[10], translate.text("#,##0.00"), true), //price text.formatDouble(item[11], translate.text("0.00"), true), //discount @@ -272,7 +276,7 @@ OfferUtils.openOfferReport = function (pOfferID) "OFFER_FOOTER", "OFFERITEM_QUANTITY", "OFFERITEM_PRICE", - "OFFERITEM_DISCOUNT", //13 + "OFFERITEM_DISCOUNT", //14 "OFFER_VERSNR", "OFFER_OFFERCODE", "OFFERITEM_VAT", @@ -296,7 +300,7 @@ OfferUtils.openOfferReport = function (pOfferID) * @param {String} [pPaymentTerm=""] * @param {String} [pSalesprojectId=""] */ -OfferUtils.copyOffer = function (pOfferId, pContactId, pLanguage, pCurrency, pHeader, pFooter, pDeliveryTerm, pPaymentTerm, pSalesprojectId) +OfferUtils.copyOffer = function (pOfferId, pContactId, pLanguage, pCurrency, pHeader, pFooter, pDeliveryTerm, pPaymentTerm, pObjectType, pRowId) { var params = { "ContactId_param" : pContactId, @@ -307,7 +311,8 @@ OfferUtils.copyOffer = function (pOfferId, pContactId, pLanguage, pCurrency, pHe "OfferFooter_param" : pFooter || "", "OfferDeliveryTerm_param" : pDeliveryTerm || "", "OfferPaymentTerm_param" : pPaymentTerm || "", - "SalesprojectId_param" : pSalesprojectId || "" + "ObjectType_param" : pObjectType || "", + "ObjectRowId_param" : pRowId || "" }; neon.openContext("Offer", null, null, neon.OPERATINGSTATE_NEW, params); } -- GitLab