Author: jacopoc
Date: Mon Sep 11 07:42:22 2006
New Revision: 442234

URL: http://svn.apache.org/viewvc?view=rev&rev=442234
Log:
Items in drop ship groups are not reserved; the shipment action links are also 
hidden in the order detail screen.

Modified:
    
incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
    
incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl

Modified: 
incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL: 
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?view=diff&rev=442234&r1=442233&r2=442234
==============================================================================
--- 
incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
 (original)
+++ 
incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
 Mon Sep 11 07:42:22 2006
@@ -734,6 +734,7 @@
         }
 
         // set the order item ship groups
+        List dropShipGroupIds = FastList.newInstance(); // this list will 
contain the ids of all the ship groups for drop shipments (no reservations)
         if (orderItemShipGroupInfo != null && orderItemShipGroupInfo.size() > 
0) {
             Iterator osiInfos = orderItemShipGroupInfo.iterator();
             while (osiInfos.hasNext()) {
@@ -744,6 +745,9 @@
                     if (valueObj.get("carrierRoleTypeId") == null) {
                         valueObj.set("carrierRoleTypeId", "CARRIER");
                     }
+                    if 
(!UtilValidate.isEmpty(valueObj.getString("supplierPartyId"))) {
+                        
dropShipGroupIds.add(valueObj.getString("shipGroupSeqId"));
+                    }
                 } else if ("OrderAdjustment".equals(valueObj.getEntityName())) 
{
                     // shipping / tax adjustment(s)
                     if (valueObj.get("orderItemSeqId") == null || 
valueObj.getString("orderItemSeqId").length() == 0) {
@@ -966,7 +970,7 @@
             // START inventory reservation
             List resErrorMessages = new LinkedList();
             try {
-                reserveInventory(delegator, dispatcher, userLogin, locale, 
orderItemShipGroupInfo, itemValuesBySeqId,
+                reserveInventory(delegator, dispatcher, userLogin, locale, 
orderItemShipGroupInfo, dropShipGroupIds, itemValuesBySeqId,
                         orderTypeId, productStoreId, resErrorMessages);
             } catch (GeneralException e) {
                 return ServiceUtil.returnError(e.getMessage());
@@ -986,7 +990,7 @@
         return successResult;
     }
 
-    public static void reserveInventory(GenericDelegator delegator, 
LocalDispatcher dispatcher, GenericValue userLogin, Locale locale, List 
orderItemShipGroupInfo, Map itemValuesBySeqId, String orderTypeId, String 
productStoreId, List resErrorMessages) throws GeneralException {
+    public static void reserveInventory(GenericDelegator delegator, 
LocalDispatcher dispatcher, GenericValue userLogin, Locale locale, List 
orderItemShipGroupInfo, List dropShipGroupIds, Map itemValuesBySeqId, String 
orderTypeId, String productStoreId, List resErrorMessages) throws 
GeneralException {
         boolean isImmediatelyFulfilled = false;
         GenericValue productStore = null;
         if (UtilValidate.isNotEmpty(productStoreId)) {
@@ -1014,15 +1018,19 @@
                 while (osiInfos.hasNext()) {
                     GenericValue orderItemShipGroupAssoc = (GenericValue) 
osiInfos.next();
                     if 
("OrderItemShipGroupAssoc".equals(orderItemShipGroupAssoc.getEntityName())) {
+                        if (dropShipGroupIds != null && 
dropShipGroupIds.contains(orderItemShipGroupAssoc.getString("shipGroupSeqId"))) 
{
+                            // the items in the drop ship groups are not 
reserved
+                            continue;
+                        }
                         GenericValue orderItem = (GenericValue) 
itemValuesBySeqId.get(orderItemShipGroupAssoc.get("orderItemSeqId"));
                         String itemStatus = orderItem.getString("statusId");
                         if ("ITEM_REJECTED".equals(itemStatus) || 
"ITEM_CANCELLED".equals(itemStatus) || "ITEM_COMPLETED".equals(itemStatus)) {
                             Debug.logInfo("Order item [" + 
orderItem.getString("orderId") + " / " + orderItem.getString("orderItemSeqId") 
+ "] is not in a proper status for reservation", module);
                             continue;
                         }
-                        if 
(UtilValidate.isNotEmpty(orderItem.getString("productId")) && 
!"RENTAL_ORDER_ITEM".equals(orderItem.getString("orderItemTypeId")))
-                        { // ignore for rental
-                            // only reserve product items; ignore non-product 
items
+                        if 
(UtilValidate.isNotEmpty(orderItem.getString("productId")) && // only reserve 
product items, ignore non-product items
+                                
!"RENTAL_ORDER_ITEM".equals(orderItem.getString("orderItemTypeId")) // ignore 
for rental
+                                ) {
                             try {
                                 Map reserveInput = new HashMap();
                                 reserveInput.put("productStoreId", 
productStoreId);
@@ -3123,6 +3131,7 @@
         toStore.addAll(cart.makeAllOrderPaymentInfos());
 
         // set the orderId & other information on all new value objects
+        List dropShipGroupIds = FastList.newInstance(); // this list will 
contain the ids of all the ship groups for drop shipments (no reservations)
         Iterator tsi = toStore.iterator();
         while (tsi.hasNext()) {
             GenericValue valueObj = (GenericValue) tsi.next();
@@ -3132,6 +3141,9 @@
                 if (valueObj.get("carrierRoleTypeId") == null) {
                     valueObj.set("carrierRoleTypeId", "CARRIER");
                 }
+                if (valueObj.get("supplierPartyId") != null) {
+                    dropShipGroupIds.add(valueObj.getString("shipGroupSeqId"));
+                }
             } else if ("OrderAdjustment".equals(valueObj.getEntityName())) {
                 // shipping / tax adjustment(s)
                 if (valueObj.get("orderItemSeqId") == null || 
valueObj.getString("orderItemSeqId").length() == 0) {
@@ -3264,7 +3276,7 @@
         List resErrorMessages = new LinkedList();
         try {
             Debug.log("Calling reserve inventory...", module);
-            reserveInventory(delegator, dispatcher, userLogin, locale, 
orderItemShipGroupAssoc, itemValuesBySeqId,
+            reserveInventory(delegator, dispatcher, userLogin, locale, 
orderItemShipGroupAssoc, dropShipGroupIds, itemValuesBySeqId,
                     orderTypeId, productStoreId, resErrorMessages);
         } catch (GeneralException e) {
             Debug.logError(e, module);

Modified: 
incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl
URL: 
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl?view=diff&rev=442234&r1=442233&r2=442234
==============================================================================
--- 
incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl 
(original)
+++ 
incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl 
Mon Sep 11 07:42:22 2006
@@ -883,7 +883,9 @@
                    <td align="left" valign="top" width="80%">
                      <div class="tabletext">
                        <#if orderHeader.orderTypeId == "SALES_ORDER">
-                         <a 
href="<@ofbizUrl>quickShipOrder?${paramString}</@ofbizUrl>" 
class="buttontext">${uiLabelMap.OrderQuickShipEntireOrder}</a>
+                         <#if !shipGroup.supplierPartyId?has_content>
+                           <a 
href="<@ofbizUrl>quickShipOrder?${paramString}</@ofbizUrl>" 
class="buttontext">${uiLabelMap.OrderQuickShipEntireOrder}</a>
+                         </#if>
                        <#else> <#-- PURCHASE_ORDER -->
                          <#if facilities?has_content>
                          <form 
action="/facility/control/quickShipPurchaseOrder" method="POST">
@@ -917,8 +919,10 @@
                    <td align="left" valign="top" width="80%">
 
                      <#if orderHeader.orderTypeId == "SALES_ORDER">
+                       <#if !shipGroup.supplierPartyId?has_content>
                        <div class="tabletext"><a 
href="/facility/control/PackOrder?facilityId=${storeFacilityId?if_exists}&orderId=${orderId}&shipGroupSeqId=${shipGroup.shipGroupSeqId}&externalLoginKey=${externalLoginKey}"
 class="buttontext">${uiLabelMap.OrderPackShipmentForShipGroup} 
[${shipGroup.shipGroupSeqId}]</a></div>
                        <div class="tabletext"><a 
href="/facility/control/createShipment?primaryOrderId=${orderId}&primaryShipGroupSeqId=${shipGroup.shipGroupSeqId}&statusId=SHIPMENT_INPUT&originFacilityId=${storeFacilityId}&externalLoginKey=${externalLoginKey}"
 class="buttontext">${uiLabelMap.OrderNewShipmentForShipGroup} 
[${shipGroup.shipGroupSeqId}]</a></div>
+                       </#if>
                      <#else>
                        <div class="tabletext">
                        <#if facilities?has_content>


Reply via email to