svn commit: r442612 - in /incubator/ofbiz/trunk/applications: order/config/ order/webapp/ordermgr/WEB-INF/actions/order/ order/webapp/ordermgr/order/ product/entitydef/ product/script/org/ofbiz/shipment/shipment/

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

svn commit: r442612 - in /incubator/ofbiz/trunk/applications: order/config/ order/webapp/ordermgr/WEB-INF/actions/order/ order/webapp/ordermgr/order/ product/entitydef/ product/script/org/ofbiz/shipment/shipment/

jacopoc
Author: jacopoc
Date: Tue Sep 12 07:59:28 2006
New Revision: 442612

URL: http://svn.apache.org/viewvc?view=rev&rev=442612
Log:
Added link to create "drop shipment" shipments from a purchase order (when the ship-to-address is not one of the company's facilities).

Modified:
    incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties
    incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh
    incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl
    incubator/ofbiz/trunk/applications/product/entitydef/entitygroup.xml
    incubator/ofbiz/trunk/applications/product/entitydef/entitymodel.xml
    incubator/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml

Modified: incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties?view=diff&rev=442612&r1=442611&r2=442612
==============================================================================
--- incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties (original)
+++ incubator/ofbiz/trunk/applications/order/config/OrderUiLabels.properties Tue Sep 12 07:59:28 2006
@@ -152,6 +152,7 @@
 OrderNewRequestItem = New Request Item
 OrderNewRequirement = New Requirement
 OrderNewShipment = New Shipment
+OrderNewDropShipmentForShipGroup = New Drop Shipment For Ship Group
 OrderNewShipmentForShipGroup = New Shipment For Ship Group
 OrderNoChannel = No Channel
 OrderNoGiftWrap = No Gift Wrap

Modified: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh?view=diff&rev=442612&r1=442611&r2=442612
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/orderview.bsh Tue Sep 12 07:59:28 2006
@@ -245,10 +245,23 @@
     context.put("mktgPkgATPMap", inventorySummary.get("mktgPkgATPMap"));
     context.put("mktgPkgQOHMap", inventorySummary.get("mktgPkgQOHMap"));
 
-    // get a list of facilities for purchase orders to receive against.  These facilities must be owned by the bill-to party of the purchase order.
+    // Get a list of facilities for purchase orders to receive against.
+    // These facilities must be owned by the bill-to party of the purchase order.
+    // For a given ship group, the allowed facilities are the ones associated
+    // to the same contact mech of the ship group.
     if ("PURCHASE_ORDER".equals(orderType)) {
-        facilities = delegator.findByAndCache("Facility", UtilMisc.toMap("ownerPartyId", orderReadHelper.getBillToParty().getString("partyId")));
-        context.put("facilities", facilities);
+        Map facilitiesForShipGroup = new HashMap();
+        String ownerPartyId = orderReadHelper.getBillToParty().getString("partyId");
+        for (int i = 0; i < shipGroups.size(); i++) {
+            GenericValue shipGroup = (GenericValue)shipGroups.get(i);
+            Map lookupMap = UtilMisc.toMap("ownerPartyId", ownerPartyId);
+            if (shipGroup.get("contactMechId") != null) {
+                lookupMap.put("contactMechId", shipGroup.getString("contactMechId"));
+            }
+            List facilities = delegator.findByAndCache("FacilityAndContactMech", lookupMap);
+            facilitiesForShipGroup.put(shipGroup.getString("shipGroupSeqId"), facilities);
+        }
+        context.put("facilitiesForShipGroup", facilitiesForShipGroup);
     }
 
     // set the type of return based on type of order

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=442612&r1=442611&r2=442612
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl Tue Sep 12 07:59:28 2006
@@ -887,6 +887,7 @@
                            <a href="<@ofbizUrl>quickShipOrder?${paramString}</@ofbizUrl>" class="buttontext">${uiLabelMap.OrderQuickShipEntireOrder}</a>
                          </#if>
                        <#else> <#-- PURCHASE_ORDER -->
+                         <#assign facilities = facilitiesForShipGroup.get(shipGroup.shipGroupSeqId)>
                          <#if facilities?has_content>
                          <form action="/facility/control/quickShipPurchaseOrder" method="POST">
                            <input type="hidden" name="initialSelected" value="Y"/>
@@ -900,8 +901,6 @@
                            </select>
                            <input type="submit" class="smallSubmit" value="${uiLabelMap.OrderQuickReceivePurchaseOrder}">
                          </form>
-                         <#else>
-                           ${uiLabelMap.ProductErrorNoFacilityAvailable}
                          </#if>
                        </#if>
                      </div>
@@ -925,6 +924,7 @@
                        </#if>
                      <#else>
                        <div class="tabletext">
+                       <#assign facilities = facilitiesForShipGroup.get(shipGroup.shipGroupSeqId)>
                        <#if facilities?has_content>
                        <form action="/facility/control/createShipment" method="GET">
                            <input type="hidden" name="primaryOrderId" value="${orderId}"/>
@@ -941,7 +941,7 @@
                          </div>
                        </form>
                        <#else>
-                         ${uiLabelMap.ProductErrorNoFacilityAvailable}
+                           <div class="tabletext"><a href="/facility/control/createShipment?primaryOrderId=${orderId}&amp;primaryShipGroupSeqId=${shipGroup.shipGroupSeqId}&amp;shipmentTypeId=DROP_SHIPMENT&amp;statusId=PURCH_SHIP_CREATED&amp;externalLoginKey=${externalLoginKey}" class="buttontext">${uiLabelMap.OrderNewDropShipmentForShipGroup} [${shipGroup.shipGroupSeqId}]</a></div>
                        </#if>
                        </div>
                      </#if>

Modified: incubator/ofbiz/trunk/applications/product/entitydef/entitygroup.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/product/entitydef/entitygroup.xml?view=diff&rev=442612&r1=442611&r2=442612
==============================================================================
--- incubator/ofbiz/trunk/applications/product/entitydef/entitygroup.xml (original)
+++ incubator/ofbiz/trunk/applications/product/entitydef/entitygroup.xml Tue Sep 12 07:59:28 2006
@@ -208,6 +208,7 @@
     <entity-group group="org.ofbiz" entity="FacilityRole" />
     <entity-group group="org.ofbiz" entity="FacilityType" />
     <entity-group group="org.ofbiz" entity="FacilityTypeAttr" />
+    <entity-group group="org.ofbiz" entity="FacilityAndContactMech" />
 
   <!-- ========================================================= -->
   <!-- org.ofbiz.product.store -->

Modified: incubator/ofbiz/trunk/applications/product/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/product/entitydef/entitymodel.xml?view=diff&rev=442612&r1=442611&r2=442612
==============================================================================
--- incubator/ofbiz/trunk/applications/product/entitydef/entitymodel.xml (original)
+++ incubator/ofbiz/trunk/applications/product/entitydef/entitymodel.xml Tue Sep 12 07:59:28 2006
@@ -3885,4 +3885,15 @@
       <field name="description" type="description"></field>
       <prim-key field="supplierRatingTypeId"/>
     </entity>
+    <view-entity entity-name="FacilityAndContactMech"
+            package-name="org.ofbiz.product.storage"
+            title="Facility and Contact Mech View Entity">
+      <member-entity entity-alias="FA" entity-name="Facility"/>
+      <member-entity entity-alias="CM" entity-name="FacilityContactMech"/>
+      <alias-all entity-alias="FA"/>
+      <alias-all entity-alias="CM"/>
+      <view-link entity-alias="FA" rel-entity-alias="CM">
+          <key-map field-name="facilityId"/>
+      </view-link>
+    </view-entity>
 </entitymodel>

Modified: incubator/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml?view=diff&rev=442612&r1=442611&r2=442612
==============================================================================
--- incubator/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml (original)
+++ incubator/ofbiz/trunk/applications/product/script/org/ofbiz/shipment/shipment/ShipmentServices.xml Tue Sep 12 07:59:28 2006
@@ -310,7 +310,9 @@
             <set value="SALES_SHIPMENT" field="shipment.shipmentTypeId"/>
         </if-compare>
         <if-compare field-name="orderHeader.orderTypeId" operator="equals" value="PURCHASE_ORDER">
-            <set value="PURCHASE_SHIPMENT" field="shipment.shipmentTypeId"/>
+            <if-compare field-name="shipment.shipmentTypeId" operator="not-equals" value="DROP_SHIPMENT">
+                <set value="PURCHASE_SHIPMENT" field="shipment.shipmentTypeId"/>
+            </if-compare>
         </if-compare>
 
         <!-- set the facility if we are from a store with a single facility -->