From d8ecd8c43989bb9e804c92f9af3906e7dc9a69b3 Mon Sep 17 00:00:00 2001 From: "j.luginger" <j.luginger@adito.de> Date: Thu, 26 Nov 2020 10:24:16 +0100 Subject: [PATCH] [Projekt: xRM-Trade 2020][TicketNr.: 1069457][Basic Angebot und Beleg Optimieren] --- entity/Offer_entity/Offer_entity.aod | 1 + .../entityfields/address/valueProcess.js | 4 +--- .../chosenaddress/onValueChange.js | 3 +-- entity/Order_entity/Order_entity.aod | 17 +++++++++++-- .../displayValueProcess.js | 2 +- .../chosendeliveryaddress/onValueChange.js | 2 +- .../chosendeliveryaddress/valueProcess.js | 24 ------------------- .../chosenpaymentaddress/onValueChange.js | 3 ++- .../chosenpaymentaddress/valueProcess.js | 24 ------------------- .../entityfields/contact_id/onValueChange.js | 7 ++++++ .../entityfields/dunningdate/valueProcess.js | 1 - .../entityfields/paydate/valueProcess.js | 1 - 12 files changed, 29 insertions(+), 60 deletions(-) delete mode 100644 entity/Order_entity/entityfields/chosendeliveryaddress/valueProcess.js delete mode 100644 entity/Order_entity/entityfields/chosenpaymentaddress/valueProcess.js create mode 100644 entity/Order_entity/entityfields/contact_id/onValueChange.js diff --git a/entity/Offer_entity/Offer_entity.aod b/entity/Offer_entity/Offer_entity.aod index d2440f9690..d9c058ba41 100644 --- a/entity/Offer_entity/Offer_entity.aod +++ b/entity/Offer_entity/Offer_entity.aod @@ -1256,6 +1256,7 @@ <dbRecordFieldMapping> <name>LETTERSALUTATION.value</name> <recordfield>OFFER.LETTERSALUTATION</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTACT_ORG_ID.displayValue</name> diff --git a/entity/Offer_entity/entityfields/address/valueProcess.js b/entity/Offer_entity/entityfields/address/valueProcess.js index a3ab606dbb..e7878513e8 100644 --- a/entity/Offer_entity/entityfields/address/valueProcess.js +++ b/entity/Offer_entity/entityfields/address/valueProcess.js @@ -1,8 +1,6 @@ -import("system.logging"); import("system.result"); import("system.vars"); -logging.log(JSON.stringify(["this.value", vars.get("$this.value")], null, "\t")); -logging.log(JSON.stringify(["OfferAddress_param", (vars.get("$param.OfferAddress_param") && vars.get("$this.value") == null)], null, "\t")); + if (vars.get("$param.OfferAddress_param") && vars.get("$this.value") == null) { result.string(vars.get("$param.OfferAddress_param")); diff --git a/entity/Offer_entity/entityfields/chosenaddress/onValueChange.js b/entity/Offer_entity/entityfields/chosenaddress/onValueChange.js index b030096712..c5042eb3c7 100644 --- a/entity/Offer_entity/entityfields/chosenaddress/onValueChange.js +++ b/entity/Offer_entity/entityfields/chosenaddress/onValueChange.js @@ -1,11 +1,10 @@ -import("system.logging"); import("system.vars"); import("system.neon"); import("PostalAddress_lib"); import("Entity_lib"); var newAddressId = vars.get("local.value"); -logging.log(JSON.stringify(["newAddressId", newAddressId, "AddressUtils.getAddressById(newAddressId)", AddressUtils.getAddressById(newAddressId)], null, "\t")); + if (newAddressId) { neon.setFieldValue("$field.ADDRESS", AddressUtils.getAddressById(newAddressId)); diff --git a/entity/Order_entity/Order_entity.aod b/entity/Order_entity/Order_entity.aod index 4ec1550e56..e7ce70d482 100644 --- a/entity/Order_entity/Order_entity.aod +++ b/entity/Order_entity/Order_entity.aod @@ -70,6 +70,7 @@ <linkedContextProcess>%aditoprj%/entity/Order_entity/entityfields/contact_id/linkedContextProcess.js</linkedContextProcess> <mandatory v="true" /> <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/contact_id/displayValueProcess.js</displayValueProcess> + <onValueChange>%aditoprj%/entity/Order_entity/entityfields/contact_id/onValueChange.js</onValueChange> <onValueChangeTypes> <element>MASK</element> </onValueChangeTypes> @@ -732,7 +733,6 @@ <documentation>%aditoprj%/entity/Order_entity/entityfields/chosenpaymentaddress/documentation.adoc</documentation> <title>Choose payment address</title> <consumer>PossibleAddresses</consumer> - <valueProcess>%aditoprj%/entity/Order_entity/entityfields/chosenpaymentaddress/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/chosenpaymentaddress/displayValueProcess.js</displayValueProcess> <onValueChange>%aditoprj%/entity/Order_entity/entityfields/chosenpaymentaddress/onValueChange.js</onValueChange> <onValueChangeTypes> @@ -746,7 +746,6 @@ <documentation>%aditoprj%/entity/Order_entity/entityfields/chosendeliveryaddress/documentation.adoc</documentation> <title>Choose delivery address</title> <consumer>PossibleAddresses</consumer> - <valueProcess>%aditoprj%/entity/Order_entity/entityfields/chosendeliveryaddress/valueProcess.js</valueProcess> <displayValueProcess>%aditoprj%/entity/Order_entity/entityfields/chosendeliveryaddress/displayValueProcess.js</displayValueProcess> <onValueChange>%aditoprj%/entity/Order_entity/entityfields/chosendeliveryaddress/onValueChange.js</onValueChange> <onValueChangeTypes> @@ -975,14 +974,17 @@ <dbRecordFieldMapping> <name>FOOTER.value</name> <recordfield>SALESORDER.FOOTER</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>HEADER.value</name> <recordfield>SALESORDER.HEADER</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>NET.value</name> <recordfield>SALESORDER.NET</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>SALESORDERCODE.value</name> @@ -993,6 +995,7 @@ <dbRecordFieldMapping> <name>SALESORDERDATE.value</name> <recordfield>SALESORDER.SALESORDERDATE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>SALESORDERID.value</name> @@ -1001,6 +1004,7 @@ <dbRecordFieldMapping> <name>VAT.value</name> <recordfield>SALESORDER.VAT</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>CONTACT_ID.value</name> @@ -1040,14 +1044,17 @@ <dbRecordFieldMapping> <name>CANCELLATION.value</name> <recordfield>SALESORDER.CANCELLATION</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DUNNINGDATE.value</name> <recordfield>SALESORDER.DUNNINGDATE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DUNNINGLEVEL.value</name> <recordfield>SALESORDER.DUNNINGLEVEL</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>ORDERSTATUS.value</name> @@ -1063,6 +1070,7 @@ <dbRecordFieldMapping> <name>PAID.value</name> <recordfield>SALESORDER.PAID</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PAYDATE.value</name> @@ -1073,6 +1081,7 @@ <dbRecordFieldMapping> <name>PAYDUEDATE.value</name> <recordfield>SALESORDER.PAYDUEDATE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>OBJECT_ROWID.value</name> @@ -1105,18 +1114,22 @@ <dbRecordFieldMapping> <name>DELIVERYADDRESS.value</name> <recordfield>SALESORDER.DELIVERYADDRESS</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>PAYMENTADDRESS.value</name> <recordfield>SALESORDER.PAYMENTADDRESS</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>NOTICE.value</name> <recordfield>SALESORDER.NOTICE</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DUNNINGTEXT.value</name> <recordfield>SALESORDER.DUNNINGTEXT</recordfield> + <isFilterable v="true" /> </dbRecordFieldMapping> <dbRecordFieldMapping> <name>DELIVERYTERMS.displayValue</name> diff --git a/entity/Order_entity/entityfields/chosendeliveryaddress/displayValueProcess.js b/entity/Order_entity/entityfields/chosendeliveryaddress/displayValueProcess.js index 0c813a182c..6edd38999f 100644 --- a/entity/Order_entity/entityfields/chosendeliveryaddress/displayValueProcess.js +++ b/entity/Order_entity/entityfields/chosendeliveryaddress/displayValueProcess.js @@ -2,4 +2,4 @@ import("system.vars"); import("PostalAddress_lib"); import("system.result"); -result.string(AddressUtils.getFormattedOnlineAddressById(vars.get("$field.ChosenPaymentAddress"))) \ No newline at end of file +result.string(AddressUtils.getFormattedOnlineAddressById(vars.get("$field.ChosenDeliveryAddress"))) \ No newline at end of file diff --git a/entity/Order_entity/entityfields/chosendeliveryaddress/onValueChange.js b/entity/Order_entity/entityfields/chosendeliveryaddress/onValueChange.js index b0019362e9..f8c2248e76 100644 --- a/entity/Order_entity/entityfields/chosendeliveryaddress/onValueChange.js +++ b/entity/Order_entity/entityfields/chosendeliveryaddress/onValueChange.js @@ -9,4 +9,4 @@ if (newAddressId) { neon.setFieldValue("$field.DELIVERYADDRESS", AddressUtils.getAddressById(newAddressId)); - } \ No newline at end of file +} \ No newline at end of file diff --git a/entity/Order_entity/entityfields/chosendeliveryaddress/valueProcess.js b/entity/Order_entity/entityfields/chosendeliveryaddress/valueProcess.js deleted file mode 100644 index f0b227bdb4..0000000000 --- a/entity/Order_entity/entityfields/chosendeliveryaddress/valueProcess.js +++ /dev/null @@ -1,24 +0,0 @@ -import("Contact_lib"); -import("system.result"); -import("system.neon"); -import("system.vars"); - -if (((vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) && vars.get("$this.value") == null)) -{ - if (vars.get("$field.DELIVERYADDRESS")) //case when a receipt is made from an offer i.e. the address is already set - { - result.string(null); - } - else - { - var defaultAddressId = ContactUtils.getDefaultAddressId(vars.get("$field.CONTACT_ID")); //otherwise get the default address - if (defaultAddressId) - result.string(defaultAddressId); - } -} -else //(i.e this.value!=null) -{ - var defaultAddressId2 = ContactUtils.getDefaultAddressId(vars.get("$field.CONTACT_ID")); //if the user changes the contact and project again, get the address of the new contact - if (defaultAddressId2) - result.string(defaultAddressId2); -} diff --git a/entity/Order_entity/entityfields/chosenpaymentaddress/onValueChange.js b/entity/Order_entity/entityfields/chosenpaymentaddress/onValueChange.js index 77ffefc857..69c4b8be23 100644 --- a/entity/Order_entity/entityfields/chosenpaymentaddress/onValueChange.js +++ b/entity/Order_entity/entityfields/chosenpaymentaddress/onValueChange.js @@ -8,6 +8,7 @@ var newAddressId = vars.get("local.value"); if (newAddressId) { neon.setFieldValue("$field.PAYMENTADDRESS", AddressUtils.getAddressById(newAddressId)); - neon.setFieldValue("$field.ChosenDeliveryAddress", AddressUtils.getAddressById(newAddressId)); + neon.setFieldValue("$field.ChosenDeliveryAddress", newAddressId); neon.setFieldValue("$field.DELIVERYADDRESS", AddressUtils.getAddressById(newAddressId)); + } \ No newline at end of file diff --git a/entity/Order_entity/entityfields/chosenpaymentaddress/valueProcess.js b/entity/Order_entity/entityfields/chosenpaymentaddress/valueProcess.js deleted file mode 100644 index 5520b6f007..0000000000 --- a/entity/Order_entity/entityfields/chosenpaymentaddress/valueProcess.js +++ /dev/null @@ -1,24 +0,0 @@ -import("Contact_lib"); -import("system.result"); -import("system.neon"); -import("system.vars"); - -if (((vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW || vars.get("$sys.recordstate") == neon.OPERATINGSTATE_EDIT) && vars.get("$this.value") == null)) -{ - if (vars.get("$field.PAYMENTADDRESS")) //case when a receipt is made from an offer i.e. the address is already set - { - result.string(null); - } - else - { - var defaultAddressId = ContactUtils.getDefaultAddressId(vars.get("$field.CONTACT_ID")); //otherwise get the default address - if (defaultAddressId) - result.string(defaultAddressId); - } -} -else //(i.e this.value!=null) -{ - var defaultAddressId2 = ContactUtils.getDefaultAddressId(vars.get("$field.CONTACT_ID")); //if the user changes the contact and project again, get the address of the new contact - if (defaultAddressId2) - result.string(defaultAddressId2); -} diff --git a/entity/Order_entity/entityfields/contact_id/onValueChange.js b/entity/Order_entity/entityfields/contact_id/onValueChange.js new file mode 100644 index 0000000000..b0695547e1 --- /dev/null +++ b/entity/Order_entity/entityfields/contact_id/onValueChange.js @@ -0,0 +1,7 @@ +import("system.neon"); +import("system.vars"); +import("Contact_lib"); + + +neon.setFieldValue("$field.ChosenPaymentAddress", ContactUtils.getDefaultAddressId(vars.get("local.value"))); +neon.setFieldValue("$field.ChosenDeliveryAddress", ContactUtils.getDefaultAddressId(vars.get("local.value"))); \ No newline at end of file diff --git a/entity/Order_entity/entityfields/dunningdate/valueProcess.js b/entity/Order_entity/entityfields/dunningdate/valueProcess.js index d5ae1be32b..ae262c3cac 100644 --- a/entity/Order_entity/entityfields/dunningdate/valueProcess.js +++ b/entity/Order_entity/entityfields/dunningdate/valueProcess.js @@ -1,4 +1,3 @@ -import("system.logging"); import("system.neon"); import("system.vars"); import("system.result"); diff --git a/entity/Order_entity/entityfields/paydate/valueProcess.js b/entity/Order_entity/entityfields/paydate/valueProcess.js index d5ae1be32b..ae262c3cac 100644 --- a/entity/Order_entity/entityfields/paydate/valueProcess.js +++ b/entity/Order_entity/entityfields/paydate/valueProcess.js @@ -1,4 +1,3 @@ -import("system.logging"); import("system.neon"); import("system.vars"); import("system.result"); -- GitLab