[ofbiz-framework] branch trunk updated: Fixed: productServiceOrder-test issue, it has been introduced after we fixed InventoryItemStatus is not updated to INV_PROMISED status(OFBIZ-8459)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Fixed: productServiceOrder-test issue, it has been introduced after we fixed InventoryItemStatus is not updated to INV_PROMISED status(OFBIZ-8459)

Pawan Verma-2
This is an automated email from the ASF dual-hosted git repository.

pawan pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 269165d  Fixed: productServiceOrder-test issue, it has been introduced after we fixed InventoryItemStatus is not updated to INV_PROMISED status(OFBIZ-8459)
269165d is described below

commit 269165d6df7188690d869f13526f16258abb356f
Author: Pawan Verma <[hidden email]>
AuthorDate: Thu May 28 19:58:27 2020 +0530

    Fixed: productServiceOrder-test issue, it has been introduced after we fixed InventoryItemStatus is not updated to INV_PROMISED status(OFBIZ-8459)
   
    Thanks, Jacques for the report.
---
 .../src/main/java/org/apache/ofbiz/order/order/OrderServices.java   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
index d56e20e..dd23e20 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
@@ -1043,6 +1043,7 @@ public class OrderServices {
             delegator.storeAll(toBeStored);
 
             List<String> resErrorMessages = new LinkedList<>();
+            GenericValue permUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
 
             // add a product service to inventory
             if (UtilValidate.isNotEmpty(orderItems)) {
@@ -1076,14 +1077,13 @@ public class OrderServices {
 
                         Map<String, Object> ripCtx = new HashMap<>();
                         if (UtilValidate.isNotEmpty(inventoryFacilityId) && UtilValidate.isNotEmpty(productId) && orderItem.getBigDecimal("quantity").compareTo(BigDecimal.ZERO) > 0) {
-                            // do something tricky here: run as the "system" user
-                            GenericValue permUserLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", "system").cache().queryOne();
                             ripCtx.put("productId", productId);
                             ripCtx.put("facilityId", inventoryFacilityId);
                             ripCtx.put("inventoryItemTypeId", "SERIALIZED_INV_ITEM");
                             ripCtx.put("statusId","INV_AVAILABLE");
                             ripCtx.put("quantityAccepted", orderItem.getBigDecimal("quantity"));
                             ripCtx.put("quantityRejected", 0.0);
+                            // do something tricky here: run as the "system" user
                             ripCtx.put("userLogin", permUserLogin);
                             try {
                                 Map<String, Object> ripResult = dispatcher.runSync("receiveInventoryProduct", ripCtx);
@@ -1103,7 +1103,7 @@ public class OrderServices {
 
             // START inventory reservation
             try {
-                reserveInventory(delegator, dispatcher, userLogin, locale, orderItemShipGroupInfo, dropShipGroupIds, itemValuesBySeqId,
+                reserveInventory(delegator, dispatcher, permUserLogin, locale, orderItemShipGroupInfo, dropShipGroupIds, itemValuesBySeqId,
                         orderTypeId, productStoreId, resErrorMessages);
             } catch (GeneralException e) {
                 return ServiceUtil.returnError(e.getMessage());