svn commit: r441752 - in /incubator/ofbiz/trunk/applications/order: entitydef/ src/org/ofbiz/order/shoppingcart/ webapp/ordermgr/WEB-INF/actions/entry/ webapp/ordermgr/entry/ webapp/ordermgr/entry/order/ webapp/ordermgr/order/

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

svn commit: r441752 - in /incubator/ofbiz/trunk/applications/order: entitydef/ src/org/ofbiz/order/shoppingcart/ webapp/ordermgr/WEB-INF/actions/entry/ webapp/ordermgr/entry/ webapp/ordermgr/entry/order/ webapp/ordermgr/order/

jacopoc
Author: jacopoc
Date: Sat Sep  9 00:24:19 2006
New Revision: 441752

URL: http://svn.apache.org/viewvc?view=rev&rev=441752
Log:
First step in the implementation of drop shipments:

* added new field "supplierPartyId" to the OrderItemShipGroup entity; if a supplier id is in this field (in a ship group of the sales order) it means that the item in the ship group will be drop shipped by the supplier
* added the new field (and accessor methods) to the ShoppingCart
* in the shipsetting order entry checkout screen, added ability to set a supplier for ship groups
* the info about the new field are now available in the order confirm and order detail screens

Next steps:

* automatic creation of a purchase order from the 'drop ship' shipment group; the ship to address in the po will be the one set in the sales order 'drop ship' shipment group
* reservations/issuances of the items in the 'drop ship' shipment group (of the sales order) should be skipped
* when the po's shipment (the drop shipment) is delivered to the customer we should change the status (completed) of the sales order items associated to the 'drop shipment' ship group

Modified:
    incubator/ofbiz/trunk/applications/order/entitydef/entitymodel.xml
    incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java
    incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
    incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
    incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/shipsettings.bsh
    incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/SetItemShipGroups.ftl
    incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/order/shipGroupConfirmSummary.ftl
    incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/shipsettings.ftl
    incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl

Modified: incubator/ofbiz/trunk/applications/order/entitydef/entitymodel.xml
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/entitydef/entitymodel.xml?view=diff&rev=441752&r1=441751&r2=441752
==============================================================================
--- incubator/ofbiz/trunk/applications/order/entitydef/entitymodel.xml (original)
+++ incubator/ofbiz/trunk/applications/order/entitydef/entitymodel.xml Sat Sep  9 00:24:19 2006
@@ -674,6 +674,7 @@
       <field name="orderId" type="id-ne"></field>
       <field name="shipGroupSeqId" type="id-ne"></field>
       <field name="shipmentMethodTypeId" type="id"></field>
+      <field name="supplierPartyId" type="id"></field>
       <field name="carrierPartyId" type="id"></field>
       <field name="carrierRoleTypeId" type="id"></field>
       <field name="contactMechId" type="id"></field>
@@ -689,6 +690,9 @@
       <prim-key field="shipGroupSeqId"/>
       <relation type="one" fk-name="ORDER_ITSG_ORDH" rel-entity-name="OrderHeader">
         <key-map field-name="orderId"/>
+      </relation>
+      <relation type="one" fk-name="ORDER_ITSG_SPRTY" title="Supplier" rel-entity-name="Party">
+        <key-map field-name="supplierPartyId" rel-field-name="partyId"/>
       </relation>
       <relation type="one" fk-name="ORDER_ITSG_CSHM" rel-entity-name="CarrierShipmentMethod">
         <key-map field-name="shipmentMethodTypeId"/>

Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java?view=diff&rev=441752&r1=441751&r2=441752
==============================================================================
--- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java (original)
+++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Sat Sep  9 00:24:19 2006
@@ -667,7 +667,8 @@
                     if (shippingContactMechId == null) {
                         shippingContactMechId = (String) request.getAttribute("contactMechId"); // FIXME
                     }
-                    callResult = checkOutHelper.finalizeOrderEntryShip(shipGroupIndex, shippingContactMechId);
+                    String supplierPartyId = request.getParameter(shipGroupIndex + "_supplierPartyId");
+                    callResult = checkOutHelper.finalizeOrderEntryShip(shipGroupIndex, shippingContactMechId, supplierPartyId);
                     ServiceUtil.addErrors(errorMessages, errorMaps, callResult);
                 }
                 // set the options

Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java?view=diff&rev=441752&r1=441751&r2=441752
==============================================================================
--- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java (original)
+++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java Sat Sep  9 00:24:19 2006
@@ -1243,12 +1243,13 @@
      * @return A Map conforming to the OFBiz Service conventions containing
      * any error messages
      */
-    public Map finalizeOrderEntryShip(int shipGroupIndex, String shippingContactMechId) {
+    public Map finalizeOrderEntryShip(int shipGroupIndex, String shippingContactMechId, String supplierPartyId) {
         Map result;
         String errMsg=null;
         //Verify the field is valid
         if (UtilValidate.isNotEmpty(shippingContactMechId)) {
             this.cart.setShippingContactMechId(shipGroupIndex, shippingContactMechId);
+            this.cart.setSupplierPartyId(shipGroupIndex, supplierPartyId);
             result = ServiceUtil.returnSuccess();
         } else {
             errMsg = UtilProperties.getMessage(resource,"checkhelper.enter_shipping_address", (cart != null ? cart.getLocale() : Locale.getDefault()));

Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?view=diff&rev=441752&r1=441751&r2=441752
==============================================================================
--- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Sat Sep  9 00:24:19 2006
@@ -2023,6 +2023,20 @@
         return null;
     }
 
+    /** Sets the supplier for the given ship group (drop shipment). */
+    public void setSupplierPartyId(int idx, String supplierPartyId) {
+        CartShipInfo csi = this.getShipInfo(idx);
+        // TODO: before we set the value we have to verify if all the products
+        //       already in this ship group are drop shippable from the supplier
+        csi.supplierPartyId = supplierPartyId;
+    }
+
+    /** Returns the supplier for the given ship group (drop shipment). */
+    public String getSupplierPartyId(int idx) {
+        CartShipInfo csi = this.getShipInfo(idx);
+        return csi.supplierPartyId;
+    }
+
     /** Sets the shipping instructions. */
     public void setShippingInstructions(int idx, String shippingInstructions) {
         CartShipInfo csi = this.getShipInfo(idx);
@@ -3618,6 +3632,7 @@
         public List shipTaxAdj = new LinkedList();
         public String contactMechId = null;
         public String shipmentMethodTypeId = null;
+        public String supplierPartyId = null;
         public String carrierRoleTypeId = null;
         public String carrierPartyId = null;
         public String giftMessage = null;
@@ -3630,6 +3645,7 @@
 
         public String getContactMechId() { return contactMechId; }
         public String getCarrierPartyId() { return carrierPartyId; }
+        public String getSupplierPartyId() { return supplierPartyId; }
         public String getShipmentMethodTypeId() { return shipmentMethodTypeId; }
 
         public List makeItemShipGroupAndAssoc(GenericDelegator delegator, ShoppingCart cart, long groupIndex) {
@@ -3649,6 +3665,7 @@
             shipGroup.set("shipmentMethodTypeId", shipmentMethodTypeId);
             shipGroup.set("carrierRoleTypeId", carrierRoleTypeId);
             shipGroup.set("carrierPartyId", carrierPartyId);
+            shipGroup.set("supplierPartyId", supplierPartyId);
             shipGroup.set("shippingInstructions", shippingInstructions);
             shipGroup.set("giftMessage", giftMessage);
             shipGroup.set("contactMechId", contactMechId);

Modified: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/shipsettings.bsh
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/shipsettings.bsh?view=diff&rev=441752&r1=441751&r2=441752
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/shipsettings.bsh (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/shipsettings.bsh Sat Sep  9 00:24:19 2006
@@ -49,6 +49,9 @@
             context.put("shippingContactMechList", shippingContactMechList);
         }
     }
+    // suppliers for the drop-ship select box
+    suppliers = delegator.findByAnd("PartyRole", UtilMisc.toMap("roleTypeId", "SUPPLIER"));
+    context.put("suppliers", suppliers);
 } else {
     // Purchase order
     if (orderPartyId != null && !orderPartyId.equals("_NA_")) {

Modified: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/SetItemShipGroups.ftl
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/SetItemShipGroups.ftl?view=diff&rev=441752&r1=441751&r2=441752
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/SetItemShipGroups.ftl (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/SetItemShipGroups.ftl Sat Sep  9 00:24:19 2006
@@ -28,10 +28,11 @@
           <td>          
             <#list 1..shoppingCart.getShipGroupSize() as currIndex>
               <#assign shipGroupIndex = currIndex - 1>
+              <#assign supplier =  delegator.findByPrimaryKey("PartyGroup", Static["org.ofbiz.base.util.UtilMisc"].toMap("partyId", shoppingCart.getSupplierPartyId(shipGroupIndex)))?if_exists />
               <table width="100%" cellpadding="1" border="0" cellpadding="0" cellspacing="0">
               <tr>
                 <td colspan="2">
-                    <div class="head1">${uiLabelMap.OrderShipGroup} # ${currIndex}</div>
+                    <div class="head1">${uiLabelMap.OrderShipGroup} # ${currIndex}<#if supplier?has_content> - ${supplier.description?default(supplier.partyId)}</#if></div>
                 </td>
               </tr>
               <tr>

Modified: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/order/shipGroupConfirmSummary.ftl
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/order/shipGroupConfirmSummary.ftl?view=diff&rev=441752&r1=441751&r2=441752
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/order/shipGroupConfirmSummary.ftl (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/order/shipGroupConfirmSummary.ftl Sat Sep  9 00:24:19 2006
@@ -38,6 +38,7 @@
 
       <tr>
         <td><span class="tableheadtext">${uiLabelMap.OrderDestination}</span></td>
+        <td><span class="tableheadtext">${uiLabelMap.PartySupplier}</span></td>
         <td><span class="tableheadtext">${uiLabelMap.ProductShipmentMethod}</span></td>
         <td><span class="tableheadtext">${uiLabelMap.ProductItem}</span></td>
         <td><span class="tableheadtext">${uiLabelMap.ProductQuantity}</span></td>
@@ -55,7 +56,7 @@
       <#if (numberOfItems > 0)>
 
       <#-- spacer goes here -->
-      <tr><td colspan="4"><hr class="sepbar"/></td></tr>
+      <tr><td colspan="5"><hr class="sepbar"/></td></tr>
 
       <tr>
 
@@ -76,6 +77,13 @@
             <#if address.stateProvinceGeoId?has_content>&nbsp;${address.stateProvinceGeoId}</#if>
             <#if address.postalCode?has_content>, ${address.postalCode?if_exists}</#if>
           </#if>
+        </td>
+
+        <#-- supplier id (for drop shipments) (also spans rows = number of items) -->
+
+        <td rowspan="${numberOfItems}" valign="top" class="tabletext">
+          <#assign supplier =  delegator.findByPrimaryKey("PartyGroup", Static["org.ofbiz.base.util.UtilMisc"].toMap("partyId", cartShipInfo.getSupplierPartyId()))?if_exists />
+          <#if supplier?has_content>${supplier.description?default(supplier.partyId)}</#if>
         </td>
 
         <#-- carrier column (also spans rows = number of items) -->

Modified: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/shipsettings.ftl
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/shipsettings.ftl?view=diff&rev=441752&r1=441751&r2=441752
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/shipsettings.ftl (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/entry/shipsettings.ftl Sat Sep  9 00:24:19 2006
@@ -114,12 +114,25 @@
 <#assign shipGroupIndex = currIndex - 1>
 
 <#assign currShipContactMechId = cart.getShippingContactMechId(shipGroupIndex)?if_exists>
-
+<#assign supplierPartyId = cart.getSupplierPartyId(shipGroupIndex)?if_exists>
             <hr class="sepbar"/>
             <table width="100%" border="0" cellpadding="1" cellspacing="0">
               <tr>
                 <td colspan="3">
                     <div class="head1">${uiLabelMap.OrderShipGroup} # ${currIndex}</div>
+                </td>
+              </tr>
+              <tr>
+                <td colspan="3">
+                    <div class="tabletext">
+                      ${uiLabelMap.PartySupplier}:
+                      <select class="selectBox" name="${shipGroupIndex?default("0")}_supplierPartyId">
+                        <option value=""></option>
+                        <#list suppliers as supplier>
+                          <option value="${supplier.partyId}"<#if supplierPartyId?exists><#if supplier.partyId == supplierPartyId> selected</#if></#if>>${Static["org.ofbiz.party.party.PartyHelper"].getPartyName(supplier, true)}</option>
+                        </#list>
+                      </select>
+                    </div>
                 </td>
               </tr>
             <#if shippingContactMechList?has_content>

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=441752&r1=441751&r2=441752
==============================================================================
--- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl (original)
+++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderheader.ftl Sat Sep  9 00:24:19 2006
@@ -728,6 +728,20 @@
                   </tr>
                 </#if>
 
+                <#if shipGroup.supplierPartyId?has_content>
+                  <#assign supplier =  delegator.findByPrimaryKey("PartyGroup", Static["org.ofbiz.base.util.UtilMisc"].toMap("partyId", shipGroup.supplierPartyId))?if_exists />
+                  <tr><td colspan="7"><hr class="sepbar"></td></tr>
+                  <tr>
+                    <td align="right" valign="top" width="15%">
+                      <div class="tabletext">&nbsp;<b>${uiLabelMap.ProductDropShipment} - ${uiLabelMap.PartySupplier}</b></div>
+                    </td>
+                    <td width="5">&nbsp;</td>
+                    <td align="left" valign="top" width="80%">
+                      <div class="tabletext"><#if supplier?has_content> - ${supplier.description?default(shipGroup.supplierPartyId)}</#if></div>
+                    </td>
+                  </tr>
+                </#if>
+
                 <#-- tracking number -->
                 <#if shipGroup.trackingNumber?has_content || orderShipmentInfoSummaryList?has_content>
                   <tr><td colspan="7"><hr class='sepbar'></td></tr>