Author: apatel
Date: Sat Aug 16 16:09:14 2014
New Revision: 1618379
URL: http://svn.apache.org/r1618379
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/branches/release13.07/applications/order/src/org/ofbiz/order/order/OrderServices.java
Modified:
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1618379&r1=1618378&r2=1618379&view=diff
==============================================================================
---
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/order/OrderServices.java
(original)
+++
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/order/OrderServices.java
Sat Aug 16 16:09:14 2014
@@ -4069,6 +4069,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());
@@ -4219,6 +4220,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;
@@ -4291,6 +4298,7 @@ public class OrderServices {
appendedItem.put("quantity",
valueObj.getBigDecimal("quantity"));
appendedItem.put("changeTypeEnumId", "ODR_ITM_APPEND");
modifiedItems.add(appendedItem);
+ newItems.add(appendedItem);
}
}
}
@@ -4340,6 +4348,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>();