[ofbiz-framework] branch release18.12 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 release18.12 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 release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


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

commit 807555a6579ad4bd3b9deac10353adcb689da8b2
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 b8b1bc3..c83b34a 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
@@ -1035,6 +1035,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)) {
@@ -1068,14 +1069,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);
@@ -1095,7 +1095,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());