Author: sichen Date: Thu Nov 16 09:09:04 2006 New Revision: 475819 URL: http://svn.apache.org/viewvc?view=rev&rev=475819 Log: Fix bugs in returns where requested return items would be added to return totals, preventing some returns from being accepted. ofbiz-463
Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?view=diff&rev=475819&r1=475818&r2=475819 ============================================================================== --- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original) +++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Thu Nov 16 09:09:04 2006 @@ -1755,7 +1755,7 @@ /** * Get the returned total by return type (credit, refund, etc.). Specify returnTypeId = null to get sum over all * return types. Specify includeAll = true to sum up over all return statuses except cancelled. Specify includeAll - * = false to sum up over RECEIVED And COMPLETED returns. + * = false to sum up over ACCEPTED,RECEIVED And COMPLETED returns. */ public BigDecimal getOrderReturnedTotalByTypeBd(String returnTypeId, boolean includeAll) { List returnedItemsBase = getOrderReturnItems(); @@ -1766,6 +1766,7 @@ // get only the RETURN_RECEIVED and RETURN_COMPLETED statusIds if (!includeAll) { + returnedItems.addAll(EntityUtil.filterByAnd(returnedItemsBase, UtilMisc.toMap("statusId", "RETURN_ACCEPTED"))); returnedItems.addAll(EntityUtil.filterByAnd(returnedItemsBase, UtilMisc.toMap("statusId", "RETURN_RECEIVED"))); returnedItems.addAll(EntityUtil.filterByAnd(returnedItemsBase, UtilMisc.toMap("statusId", "RETURN_COMPLETED"))); } else { @@ -1773,7 +1774,6 @@ returnedItems.addAll(EntityUtil.filterByAnd(returnedItemsBase, UtilMisc.toList(new EntityExpr("statusId", EntityOperator.NOT_EQUAL, "RETURN_CANCELLED")))); } - BigDecimal returnedAmount = ZERO; Iterator i = returnedItems.iterator(); String orderId = orderHeader.getString("orderId"); Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?view=diff&rev=475819&r1=475818&r2=475819 ============================================================================== --- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java (original) +++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Thu Nov 16 09:09:04 2006 @@ -102,7 +102,7 @@ adj = new Double(0); } - double returnTotal = orh.getOrderReturnedTotal(true); + double returnTotal = orh.getOrderReturnedTotal(false); double orderTotal = orh.getOrderGrandTotal(); double available = orderTotal - returnTotal - adj.doubleValue();