From 7de6016e9aa9a26b48579238f34ed9518f3a3dfb Mon Sep 17 00:00:00 2001
From: "b.ulrich" <b.ulrich@adito.de>
Date: Fri, 31 Jul 2020 09:23:35 +0200
Subject: [PATCH] [Projekt: Entwicklung - Neon][TicketNr.: 1061849][Anlage von
 Angebotsposition zieht falschen Preis von Produkt]

---
 process/Product_lib/process.js | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/process/Product_lib/process.js b/process/Product_lib/process.js
index d49860b7ac4..c6e9a85c7e3 100644
--- a/process/Product_lib/process.js
+++ b/process/Product_lib/process.js
@@ -283,8 +283,21 @@ ProductUtils.getProductDetails = function(pid, priceListFilter, additionalProduc
                 return priceLists[list];
             }
             //customer deposited price list (defined by Attribute)
-            if (priceListFilter.priceList != "" && priceListFilter.priceList == priceLists[list].priceList) {
-                return priceLists[list];
+            if (priceListFilter.priceList != "") {
+                var res;
+                var escape;
+                 // runs trough the possible pricelists to find the one with the correct pricelist ("-type"). 
+                 // e.g: PRICELISTSERVICE, PRICELISTSPECIAL, PRICELISTKEY, PRICELISTDEFAULT
+                for(var index in priceLists)
+                {
+                    
+                    if (!escape && priceLists[index]["priceList"] == priceListFilter.priceList) 
+                    {
+                        res = priceLists[index]; //The first time the condition is true the correct pricelist is found.
+                        escape = true;          // The object is ordered by fromQuantity descending so we have to stop after the condition is true
+                    }
+                }
+                return res;
             }
             //default price list
             if (priceLists[list].priceList == $KeywordRegistry.productPricelist$standardList()) {
-- 
GitLab