From 2639a596b233045d2b7104a53567a1a0cd13aa77 Mon Sep 17 00:00:00 2001 From: "c.manhart" <c.manhart@adito.de> Date: Thu, 14 Jan 2021 09:22:56 +0100 Subject: [PATCH] [Projekt: Entwicklung - xRM][TicketNr.: 1071354][Neue Angebotsversion / Angebot kopieren mit Untergeordneten Angebotsposten Fehlerhaft] --- process/Neon_lib/process.js | 10 +++++++--- process/Offer_lib/process.js | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/process/Neon_lib/process.js b/process/Neon_lib/process.js index 4d7d910d5d..18402adc55 100644 --- a/process/Neon_lib/process.js +++ b/process/Neon_lib/process.js @@ -154,7 +154,7 @@ CopyModuleUtils.copyModule = function(pInputMapping) //root mapping var rootModule = Object.keys(pInputMapping)[0]; var ModuleMapping = _ModuleMapping(rootModule, pInputMapping[rootModule]); - var ModuleData = _getModuleData(rootModule, pInputMapping[rootModule].condition); + var ModuleData = _getModuleData(rootModule, pInputMapping[rootModule].condition, pInputMapping[rootModule].order); ModulesMapping[rootModule] = ModuleMapping; for(var row in ModuleData) @@ -171,15 +171,19 @@ CopyModuleUtils.copyModule = function(pInputMapping) //delivers stored data for module in Database with condition - function _getModuleData(pModule, pCondition) + function _getModuleData(pModule, pCondition, pOrder) { if(pModule == undefined) return {}; var ModuleColumnsStructure = AliasDefinitionStructure.tables[pModule].columns; var cols = Object.keys(ModuleColumnsStructure); var dataQuery = newSelect(cols).from(pModule); + if(pCondition != undefined) - dataQuery.where(pCondition) + dataQuery.where(pCondition); + + if(pOrder != undefined) + dataQuery.orderBy(pOrder); var dbData = dataQuery.table(); diff --git a/process/Offer_lib/process.js b/process/Offer_lib/process.js index 86cc96712a..0527be16d8 100644 --- a/process/Offer_lib/process.js +++ b/process/Offer_lib/process.js @@ -406,7 +406,8 @@ OfferUtils.copyOfferItems = function (pSourceOfferId, pTargetOfferId, pDiscount) condition: newWhere("OFFERITEM.OFFER_ID", pSourceOfferId), ValueMapping: { "OFFER_ID": pTargetOfferId - } + }, + order: ["ASSIGNEDTO", "ITEMSORT"] } }; CopyModuleUtils.copyModule(inputMapping); -- GitLab