diff --git a/entity/Offer_entity/entityfields/deliveryterms/valueProcess.js b/entity/Offer_entity/entityfields/deliveryterms/valueProcess.js index ff143a3b866db9b739ae9532997d6dd4041b5a89..58333ceee85c85ca43b36ec1a03d4d3067f6a9a9 100644 --- a/entity/Offer_entity/entityfields/deliveryterms/valueProcess.js +++ b/entity/Offer_entity/entityfields/deliveryterms/valueProcess.js @@ -11,7 +11,7 @@ if (vars.exists("$param.OfferDeliveryTerm_param") && vars.get("$param.OfferDeliv { result.string(vars.get("$param.OfferDeliveryTerm_param")); } -else if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +else if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null && vars.get("$field.CONTACT_ID")) { var presetValue = ""; var contactIds = ContactUtils.getPersOrgIds(vars.getString("$field.CONTACT_ID")) diff --git a/entity/Offer_entity/entityfields/paymentterms/valueProcess.js b/entity/Offer_entity/entityfields/paymentterms/valueProcess.js index 4b13796a10e4c66b70d7abe004fa7369b3c515b3..b9fd6cd7aee19dcfa86cb5e4625f9998548efd02 100644 --- a/entity/Offer_entity/entityfields/paymentterms/valueProcess.js +++ b/entity/Offer_entity/entityfields/paymentterms/valueProcess.js @@ -11,7 +11,7 @@ if (vars.exists("$param.OfferPaymentTerm_param") && vars.get("$param.OfferPaymen { result.string(vars.get("$param.OfferPaymentTerm_param")); } -else if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW) +else if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null && vars.get("$field.CONTACT_ID")) { var presetValue = ""; var contactIds = ContactUtils.getPersOrgIds(vars.getString("$field.CONTACT_ID")) diff --git a/entity/Order_entity/entityfields/deliveryterms/valueProcess.js b/entity/Order_entity/entityfields/deliveryterms/valueProcess.js index 8e6fb1be5bc999ff98be26570bbd8ff5d5233ff1..ed78d05852c8a088d333cf55307036313541b3e1 100644 --- a/entity/Order_entity/entityfields/deliveryterms/valueProcess.js +++ b/entity/Order_entity/entityfields/deliveryterms/valueProcess.js @@ -9,7 +9,7 @@ import("Contact_lib"); -if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null && vars.get("$field.CONTACT_ID")) { var presetValue = ""; var contactIds = ContactUtils.getPersOrgIds(vars.getString("$field.CONTACT_ID")); diff --git a/entity/Order_entity/entityfields/paymentterms/valueProcess.js b/entity/Order_entity/entityfields/paymentterms/valueProcess.js index 7501b966d14bf76fa1fc2ded5b655a8f0e3e9129..8cf77fdb2b60bc5b819d97a770b3b3c3e8cd8199 100644 --- a/entity/Order_entity/entityfields/paymentterms/valueProcess.js +++ b/entity/Order_entity/entityfields/paymentterms/valueProcess.js @@ -7,23 +7,23 @@ import("system.result"); import("system.vars"); import("Attribute_lib"); -if (vars.get("$this.value") == null) { - if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null) + +if (vars.get("$sys.recordstate") == neon.OPERATINGSTATE_NEW && vars.get("$this.value") == null && vars.get("$field.CONTACT_ID")) +{ + var presetValue = ""; + var contactIds = ContactUtils.getPersOrgIds(vars.getString("$field.CONTACT_ID")); + if (contactIds.length >= 3 && contactIds[2]) { - var presetValue = ""; - var contactIds = ContactUtils.getPersOrgIds(vars.getString("$field.CONTACT_ID")); - if (contactIds.length >= 3 && contactIds[2]) - { - var orgContactId = ContactUtils.getOrgContactId(contactIds[2]); - if (orgContactId) - { - presetValue = new AttributeRelationQuery(orgContactId, $AttributeRegistry.paymentTerm()).getSingleAttributeValue(); - } + var orgContactId = ContactUtils.getOrgContactId(contactIds[2]); + if (orgContactId) + { + presetValue = new AttributeRelationQuery(orgContactId, $AttributeRegistry.paymentTerm()).getSingleAttributeValue(); } - - if (presetValue) - result.string(presetValue); - else - result.string(KeywordUtils.getFirst($KeywordRegistry.paymentTerm())); } + + if (presetValue) + result.string(presetValue); + else + result.string(KeywordUtils.getFirst($KeywordRegistry.paymentTerm())); } +