You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2014/03/03 19:01:36 UTC

svn commit: r1573640 - in /ofbiz/branches/release13.07: ./ applications/order/src/org/ofbiz/order/order/OrderServices.java applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml

Author: jleroux
Date: Mon Mar  3 18:01:35 2014
New Revision: 1573640

URL: http://svn.apache.org/r1573640
Log:
"Applied fix from trunk for revision: 1573639 " 
------------------------------------------------------------------------
r1573639 | jleroux | 2014-03-03 18:58:54 +0100 (lun. 03 mars 2014) | 23 lignes

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/branches/release13.07/   (props changed)
    ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/order/OrderServices.java
    ofbiz/branches/release13.07/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml

Propchange: ofbiz/branches/release13.07/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1573639

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=1573640&r1=1573639&r2=1573640&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 Mon Mar  3 18:01:35 2014
@@ -2172,15 +2172,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/branches/release13.07/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml?rev=1573640&r1=1573639&r2=1573640&view=diff
==============================================================================
--- ofbiz/branches/release13.07/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml (original)
+++ ofbiz/branches/release13.07/applications/product/script/org/ofbiz/shipment/receipt/ShipmentReceiptServices.xml Mon Mar  3 18:01:35 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 -->