Author: jleroux Date: Mon Mar 3 13:06:04 2014 New Revision: 1573552 URL: http://svn.apache.org/r1573552 Log: A patch from Deepak Dixit for "Order item status change issue." https://issues.apache.org/jira/browse/OFBIZ-4953
Steps to regenerate issue: - Crate an SO/PO with more then one line item. - Partially ship/received any one order item. - After partial ship/receive order should be in approve status, one order item in in completed status and another one is in Approved status. - Change order status to hold. - Now again approve order. - After approve all order order except Completed/cancelled item should go in Approved status. But as per the current behavior completed order item also change to approved status. Here is the updated patch, this include the cancel received item flow. ITEM_REJECTED status change will be handled by StatusValidChange flow. jleroux: considering the current effort to remove Javolution use when possible, I have replaced FastList.<EntityExpr>newInstance(); by new ArrayList<EntityExpr>(); 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=1573552&r1=1573551&r2=1573552&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 Mon Mar 3 13:06:04 2014 @@ -2174,15 +2174,18 @@ public class OrderServices { "OrderYouDoNotHavePermissionToChangeThisOrdersStatus",locale)); } - Map<String, String> fields = UtilMisc.<String, String>toMap("orderId", orderId); + List<EntityExpr> exprs = new ArrayList<EntityExpr>(); + exprs.add(EntityCondition.makeCondition("orderId", orderId)); if (orderItemSeqId != null) - fields.put("orderItemSeqId", orderItemSeqId); + exprs.add(EntityCondition.makeCondition("orderItemSeqId", orderItemSeqId)); if (fromStatusId != null) - fields.put("statusId", fromStatusId); + exprs.add(EntityCondition.makeCondition("statusId", fromStatusId)); + else + exprs.add(EntityCondition.makeCondition("statusId", EntityOperator.NOT_IN, UtilMisc.toList("ITEM_COMPLETED", "ITEM_CANCELLED"))); List<GenericValue> orderItems = null; try { - orderItems = delegator.findByAnd("OrderItem", fields, null, false); + orderItems = delegator.findList("OrderItem", EntityCondition.makeCondition(exprs, EntityOperator.AND), null, null, null, false); } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderErrorCannotGetOrderItemEntity",locale) + e.getMessage());