svn commit: r779899 - /ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r779899 - /ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java

mor-2
Author: mor
Date: Fri May 29 09:23:10 2009
New Revision: 779899

URL: http://svn.apache.org/viewvc?rev=779899&view=rev
Log:
Saving partyIdTo and partyIdFrom in the Shipment that is created through verify pick screen in facility. Issue reported by Akash Jain in OFBIZ-2542

Modified:
    ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java?rev=779899&r1=779898&r2=779899&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/shipment/verify/VerifyPickSession.java Fri May 29 09:23:10 2009
@@ -347,13 +347,23 @@
     }
 
     protected String createShipment(VerifyPickSessionRow line) throws GeneralException {
+        GenericDelegator delegator = this.getDelegator();
+        String orderId = line.getOrderId();
         Map<String, Object> newShipment = FastMap.newInstance();
         newShipment.put("originFacilityId", facilityId);
         newShipment.put("primaryShipGroupSeqId", line.getShipGroupSeqId());
-        newShipment.put("primaryOrderId", line.getOrderId());
+        newShipment.put("primaryOrderId", orderId);
         newShipment.put("shipmentTypeId", "OUTGOING_SHIPMENT");
         newShipment.put("statusId", "SHIPMENT_PICKED");
         newShipment.put("userLogin", this.getUserLogin());
+        GenericValue orderRoleShipTo = EntityUtil.getFirst(delegator.findByAnd("OrderRole", UtilMisc.toMap("orderId", orderId, "roleTypeId", "SHIP_TO_CUSTOMER")));
+        if (UtilValidate.isNotEmpty(orderRoleShipTo)) {
+            newShipment.put("partyIdTo", orderRoleShipTo.getString("partyId"));
+        }
+        GenericValue orderRoleShipFrom = EntityUtil.getFirst(delegator.findByAnd("OrderRole", UtilMisc.toMap("orderId", orderId, "roleTypeId", "SHIP_FROM_VENDOR")));
+        if (UtilValidate.isNotEmpty(orderRoleShipFrom)) {
+            newShipment.put("partyIdFrom", orderRoleShipFrom.getString("partyId"));
+        }
         Map<String, Object> newShipResp = this.getDispatcher().runSync("createShipment", newShipment);
         if (ServiceUtil.isError(newShipResp)) {
             throw new GeneralException(ServiceUtil.getErrorMessage(newShipResp));