You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by su...@apache.org on 2021/03/27 10:51:31 UTC

[ofbiz-framework] branch trunk updated: Fixed: ChangeReason was not being set on OrderStatus when orderItem was marked cancelled with reason. (OFBIZ-12210) Thanks Lalit Dashora for reporting the issue and providing the patch.

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

surajk 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 933c3e0  Fixed: ChangeReason was not being set on OrderStatus when orderItem was marked cancelled with reason. (OFBIZ-12210) Thanks Lalit Dashora for reporting the issue and providing the patch.
933c3e0 is described below

commit 933c3e0bc6bc29d142f0ed9f922f0332bcb76df6
Author: Suraj Khurana <su...@hotwax.co>
AuthorDate: Sat Mar 27 16:20:31 2021 +0530

    Fixed: ChangeReason was not being set on OrderStatus when orderItem was marked cancelled with reason.
    (OFBIZ-12210)
    Thanks Lalit Dashora for reporting the issue and providing the patch.
---
 .../java/org/apache/ofbiz/order/order/OrderServices.java    | 13 +++++++------
 1 file changed, 7 insertions(+), 6 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 c7cf40f..36cc526 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
@@ -2237,15 +2237,14 @@ public class OrderServices {
                             return ServiceUtil.returnError(e.getMessage());
                         }
                     }
-
+                    String reasonEnumId = null;
+                    if (UtilValidate.isNotEmpty(itemReasonMap)) {
+                        reasonEnumId = itemReasonMap.get(orderItem.getString("orderItemSeqId"));
+                    }
 
                     //  create order item change record
                     if (!"Y".equals(orderItem.getString("isPromo"))) {
-                        String reasonEnumId = null;
                         String changeComments = null;
-                        if (UtilValidate.isNotEmpty(itemReasonMap)) {
-                            reasonEnumId = itemReasonMap.get(orderItem.getString("orderItemSeqId"));
-                        }
                         if (UtilValidate.isNotEmpty(itemCommentMap)) {
                             changeComments = itemCommentMap.get(orderItem.getString("orderItemSeqId"));
                         }
@@ -2298,7 +2297,7 @@ public class OrderServices {
                         }
                         // all items are cancelled -- mark the item as cancelled
                         Map<String, Object> statusCtx = UtilMisc.<String, Object>toMap("orderId", orderId, "orderItemSeqId", orderItem.getString(
-                                "orderItemSeqId"), "statusId", itemStatus, "userLogin", userLogin);
+                                "orderItemSeqId"), "statusId", itemStatus, "changeReason", reasonEnumId, "userLogin", userLogin);
                         try {
                             dispatcher.runSyncIgnore("changeOrderItemStatus", statusCtx);
                         } catch (GenericServiceException e) {
@@ -2343,6 +2342,7 @@ public class OrderServices {
         String orderItemSeqId = (String) context.get("orderItemSeqId");
         String fromStatusId = (String) context.get("fromStatusId");
         String statusId = (String) context.get("statusId");
+        String changeReason = (String) context.get("changeReason");
         Timestamp statusDateTime = (Timestamp) context.get("statusDateTime");
         Locale locale = (Locale) context.get("locale");
 
@@ -2421,6 +2421,7 @@ public class OrderServices {
                 changeFields.put("statusId", statusId);
                 changeFields.put("orderId", orderId);
                 changeFields.put("orderItemSeqId", orderItem.getString("orderItemSeqId"));
+                changeFields.put("changeReason", changeReason);
                 changeFields.put("statusDatetime", statusDateTime);
                 changeFields.put("statusUserLogin", userLogin.getString("userLoginId"));
                 GenericValue orderStatus = delegator.makeValue("OrderStatus", changeFields);