You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ap...@apache.org on 2014/08/16 18:02:33 UTC
svn commit: r1618378 -
/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
Author: apatel
Date: Sat Aug 16 16:02:32 2014
New Revision: 1618378
URL: http://svn.apache.org/r1618378
Log:
[OFBIZ-5424] Now creating status items for promotion order items. Thanks Christian Carlow for reporting the issue and ofbiz.us team for the fix.
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1618378&r1=1618377&r2=1618378&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Sat Aug 16 16:02:32 2014
@@ -4071,6 +4071,7 @@ public class OrderServices {
// get the new orderItems, adjustments, shipping info, payments and order item attributes from the cart
List<Map<String, Object>> modifiedItems = FastList.newInstance();
+ List<Map<String, Object>> newItems = FastList.newInstance();
List<GenericValue> toStore = new LinkedList<GenericValue>();
List<GenericValue> toAddList = new ArrayList<GenericValue>();
toAddList.addAll(cart.makeAllAdjustments());
@@ -4221,6 +4222,12 @@ public class OrderServices {
// ignore promotion items. They are added/canceled automatically
if ("Y".equals(valueObj.getString("isPromo"))) {
+ //Fetching the new promo items and adding it to list so that we can create OrderStatus record for that items.
+ Map<String, Object> promoItem = FastMap.newInstance();
+ promoItem.put("orderId", valueObj.getString("orderId"));
+ promoItem.put("orderItemSeqId", valueObj.getString("orderItemSeqId"));
+ promoItem.put("quantity", valueObj.getBigDecimal("quantity"));
+ newItems.add(promoItem);
continue;
}
GenericValue oldOrderItem = null;
@@ -4293,6 +4300,7 @@ public class OrderServices {
appendedItem.put("quantity", valueObj.getBigDecimal("quantity"));
appendedItem.put("changeTypeEnumId", "ODR_ITM_APPEND");
modifiedItems.add(appendedItem);
+ newItems.add(appendedItem);
}
}
}
@@ -4342,6 +4350,20 @@ public class OrderServices {
}
}
+ //To create record of OrderStatus entity
+ if (UtilValidate.isNotEmpty(newItems)) {
+ for (Map<String, Object> newItem : newItems) {
+ String itemStatusId = delegator.getNextSeqId("OrderStatus");
+ GenericValue itemStatus = delegator.makeValue("OrderStatus", UtilMisc.toMap("orderStatusId", itemStatusId));
+ itemStatus.put("statusId", "ITEM_CREATED");
+ itemStatus.put("orderId", newItem.get("orderId"));
+ itemStatus.put("orderItemSeqId", newItem.get("orderItemSeqId"));
+ itemStatus.put("statusDatetime", UtilDateTime.nowTimestamp());
+ itemStatus.set("statusUserLogin", userLogin.get("userLogin"));
+ delegator.create(itemStatus);
+ }
+ }
+
// make the order item object map & the ship group assoc list
List<GenericValue> orderItemShipGroupAssoc = new LinkedList<GenericValue>();
Map<String, GenericValue> itemValuesBySeqId = new HashMap<String, GenericValue>();