ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jler...@apache.org
Subject svn commit: r1573639 - in /ofbiz/trunk/applications: order/src/org/ofbiz/order/order/OrderServices.java product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml
Date Mon, 03 Mar 2014 17:58:55 GMT
Author: jleroux
Date: Mon Mar  3 17:58:54 2014
New Revision: 1573639

URL: http://svn.apache.org/r1573639
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>();

I formatted to use {} around one line code



Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
    ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml

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=1573639&r1=1573638&r2=1573639&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
17:58:54 2014
@@ -2174,15 +2174,19 @@ public class OrderServices {
                     "OrderYouDoNotHavePermissionToChangeThisOrdersStatus",locale));
         }
 
-        Map<String, String> fields = UtilMisc.<String, String>toMap("orderId",
orderId);
-        if (orderItemSeqId != null)
-            fields.put("orderItemSeqId", orderItemSeqId);
-        if (fromStatusId != null)
-            fields.put("statusId", fromStatusId);
+        List<EntityExpr> exprs = new ArrayList<EntityExpr>();
+        exprs.add(EntityCondition.makeCondition("orderId", orderId));
+        if (orderItemSeqId != null) {
+            exprs.add(EntityCondition.makeCondition("orderItemSeqId", orderItemSeqId));
+        } if (fromStatusId != null) {
+            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());

Modified: ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml?rev=1573639&r1=1573638&r2=1573639&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml
(original)
+++ ofbiz/trunk/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml
Mon Mar  3 17:58:54 2014
@@ -547,6 +547,7 @@ under the License.
             <!-- update the order item status -->
             <set field="orderItem.statusId" value="ITEM_APPROVED"/>
             <set-service-fields service-name="changeOrderItemStatus" map="orderItem" to-map="orderItemCtx"/>
+            <set field="orderItemCtx.fromStatusId" value="ITEM_COMPLETED"/>
             <call-service service-name="changeOrderItemStatus" in-map-name="orderItemCtx"/>
             <get-related-one value-field="orderItem" relation-name="OrderHeader" to-value-field="orderHeader"/>
             <!-- cancel the invoice -->



Mime
View raw message