Author: bibryam
Date: Tue May 6 07:05:34 2008
New Revision: 653780
URL:
http://svn.apache.org/viewvc?rev=653780&view=revLog:
Fixed a bug for canceling some quantity of order Items.
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=653780&r1=653779&r2=653780&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 Tue May 6 07:05:34 2008
@@ -1836,8 +1836,17 @@
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderErrorCannotCancelItemItemNotFound", UtilMisc.toMap("itemMsgInfo",itemMsgInfo), locale));
}
- Double availableQuantity = orderItemShipGroupAssoc.getDouble("quantity");
- Double itemQuantity = orderItem.getDouble("quantity");
+ Double aisgaCancelQuantity = orderItemShipGroupAssoc.getDouble("cancelQuantity");
+ if (aisgaCancelQuantity == null) {
+ aisgaCancelQuantity = new Double(0.0);
+ }
+ Double availableQuantity = Double.valueOf(orderItemShipGroupAssoc.getDouble("quantity").doubleValue() - aisgaCancelQuantity.doubleValue());
+
+ Double itemCancelQuantity = orderItem.getDouble("cancelQuantity");
+ if (itemCancelQuantity == null) {
+ itemCancelQuantity = new Double(0.0);
+ }
+ Double itemQuantity = Double.valueOf(orderItem.getDouble("quantity").doubleValue() - itemCancelQuantity.doubleValue());
if (availableQuantity == null) availableQuantity = new Double(0.0);
if (itemQuantity == null) itemQuantity = new Double(0.0);
@@ -1849,8 +1858,8 @@
}
if (availableQuantity.doubleValue() >= thisCancelQty.doubleValue()) {
- orderItem.set("cancelQuantity", thisCancelQty);
- orderItemShipGroupAssoc.set("cancelQuantity", thisCancelQty);
+ orderItem.set("cancelQuantity", Double.valueOf(itemCancelQuantity.doubleValue() + thisCancelQty.doubleValue()));
+ orderItemShipGroupAssoc.set("cancelQuantity", Double.valueOf(aisgaCancelQuantity.doubleValue() + thisCancelQty.doubleValue()));
try {
List toStore = UtilMisc.toList(orderItem, orderItemShipGroupAssoc);