From fcf2df88e3b00a64112a8d27a470529c1cea62b2 Mon Sep 17 00:00:00 2001 From: Benjamin Ulrich <b.ulrich@adito.de> Date: Thu, 30 Jan 2020 15:00:42 +0000 Subject: [PATCH] =?UTF-8?q?[Projekt:=20Entwicklung=20-=20Neon][TicketNr.:?= =?UTF-8?q?=201050510][Probleme=20bei=20der=20Verkn=C3=BCpfung=20zwischen?= =?UTF-8?q?=20Beleg=20und=20Vertriebsprojekt]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit e446bf281e288848307fbd2bfbb4023f53bc14a8) --- entity/Order_entity/Order_entity.aod | 1 - .../objectrowid_param/valueProcess.js | 0 .../children/contactid_param/valueProcess.js | 8 +++++-- process/Order_lib/process.js | 22 +++++++++---------- 4 files changed, 17 insertions(+), 14 deletions(-) delete mode 100644 entity/Order_entity/entityfields/objectrowid_param/valueProcess.js diff --git a/entity/Order_entity/Order_entity.aod b/entity/Order_entity/Order_entity.aod index 33b6cb0258..6c5316dbfc 100644 --- a/entity/Order_entity/Order_entity.aod +++ b/entity/Order_entity/Order_entity.aod @@ -594,7 +594,6 @@ </entityParameter> <entityParameter> <name>ObjectRowId_param</name> - <valueProcess>%aditoprj%/entity/Order_entity/entityfields/objectrowid_param/valueProcess.js</valueProcess> <expose v="true" /> <documentation>%aditoprj%/entity/Order_entity/entityfields/objectrowid_param/documentation.adoc</documentation> <description>PARAMETER</description> diff --git a/entity/Order_entity/entityfields/objectrowid_param/valueProcess.js b/entity/Order_entity/entityfields/objectrowid_param/valueProcess.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/entity/Order_entity/entityfields/objects/children/contactid_param/valueProcess.js b/entity/Order_entity/entityfields/objects/children/contactid_param/valueProcess.js index c5efd0f6d8..0d0a95eccc 100644 --- a/entity/Order_entity/entityfields/objects/children/contactid_param/valueProcess.js +++ b/entity/Order_entity/entityfields/objects/children/contactid_param/valueProcess.js @@ -1,3 +1,4 @@ +import("system.db"); import("system.result"); import("system.vars"); import("Contact_lib"); @@ -5,6 +6,9 @@ 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(ids[2]); + if (ids.length >= 3 && ids[2]){ + result.string(db.cell("select CONTACTID from CONTACT" ++ " join ORGANISATION on ORGANISATIONID = ORGANISATION_ID" ++ " where ORGANISATION_ID = '" + ids[2] + "'" ++ " and PERSON_ID is null"))} } \ No newline at end of file diff --git a/process/Order_lib/process.js b/process/Order_lib/process.js index a8012d6718..b4ef3fa6d0 100644 --- a/process/Order_lib/process.js +++ b/process/Order_lib/process.js @@ -93,13 +93,13 @@ OrderUtils.createNewOrder = function(pContextId, pRowId, pRelationId) } //TODO refactor function to minimize the params and only give an object that contains the data -OrderUtils.copyOrder = function (pOfferId, pContactId, pOrderType, pLanguage, pCurrency, pHeader, pFooter, pDeliveryTerm, pPaymentTerm, pPaymentAddress, pDeliveryAddress, pObjectType, pRowId, pDunningDate, pDunningLevel, pCancellation, pOrderStatus) +OrderUtils.copyOrder = function (pSourceOfferId, pContactId, pOrderType, pLanguage, pCurrency, pHeader, pFooter, pDeliveryTerm, pPaymentTerm, pPaymentAddress, pDeliveryAddress, pObjectType, pRowId, pDunningDate, pDunningLevel, pCancellation, pOrderStatus) { var params = { "ContactId_param" : pContactId, "OrderType_param" : pOrderType, "OrderLanguage_param" : pLanguage, - "OfferId_param" : pOfferId, + "OfferId_param" : pSourceOfferId, "OrderCurrency_param" : pCurrency || "", "OrderHeader_param" : pHeader || "", "OrderFooter_param" : pFooter || "", @@ -121,10 +121,10 @@ OrderUtils.copyOrder = function (pOfferId, pContactId, pOrderType, pLanguage, pC /** * copies all offerItems of an offer and creates orderItems for an order * - * @param {String} pOfferId the offer to get the items from - * @param {String} pOrderId the order to create the items for + * @param {String} pSourceOfferId the offer to get the items from + * @param {String} pSourceOfferId the order to create the items for */ -OrderUtils.copyOfferItemsToOrder = function (pSourceOfferId, pOrderId) +OrderUtils.copyOfferItemsToOrder = function (pSourceOfferId, pSourceOfferId) { var InputMapping = { "OFFERITEM": { @@ -146,21 +146,21 @@ OrderUtils.copyOfferItemsToOrder = function (pSourceOfferId, pOrderId) "INFO" : "INFO", "VAT" : "VAT" }, - condition: newWhereIfSet("OFFERITEM.OFFER_ID", pOfferId).orderBy("ITEMSORT").toString("1=2", true), + condition: newWhereIfSet("OFFERITEM.OFFER_ID", pSourceOfferId).orderBy("ITEMSORT").toString("1=2", true), ValueMapping: { - "OFFER_ID" : pOrderId + "OFFER_ID" : pSourceOfferId } } }; CopyModuleUtils.copyModule(InputMapping); - var oiUtils = new OrderItemUtils(pOrderId); + var oiUtils = new OrderItemUtils(pSourceOfferId); //update order price cols = ["NET", "VAT"]; var vals = oiUtils.getNetAndVat(); - newWhere("SALESORDER.SALESORDERID", pOrderId) + newWhere("SALESORDER.SALESORDERID", pSourceOfferId) .updateData(true, "SALESORDER", cols, null, vals); } @@ -557,9 +557,9 @@ OrderUtils.openReminderReport = function (pOrderID) * * @class */ -function OrderItemUtils(pOrderId) { +function OrderItemUtils(pSourceOfferId) { // extends ItemUtils - ItemUtils.apply(this, [pOrderId, "SALESORDER"]); + ItemUtils.apply(this, [pSourceOfferId, "SALESORDER"]); OrderItemUtils.prototype = Object.create(ItemUtils.prototype); OrderItemUtils.prototype.constructor = OrderItemUtils; } -- GitLab