[OFBiz] SVN: r7889 - in trunk/applications/order/webapp/ordermgr: WEB-INF/actions/entry entry

jacopo@svn.ofbiz.org jacopo at svn.ofbiz.org
Wed Jun 28 02:21:04 CDT 2006


Author: jacopo
Date: 2006-06-28 02:20:52 -0500 (Wed, 28 Jun 2006)
New Revision: 7889

Modified:
   trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/shipsettings.bsh
   trunk/applications/order/webapp/ordermgr/entry/shipsettings.ftl
Log:
In po checkout, the ship to addresses are now pulled from the facilities owned by the billToCustomer party (i.e. the company selected in the drop down of the create order entry first screen) instead of from the facility of the product store.


Modified: trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/shipsettings.bsh
===================================================================
--- trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/shipsettings.bsh	2006-06-28 06:23:35 UTC (rev 7888)
+++ trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/shipsettings.bsh	2006-06-28 07:20:52 UTC (rev 7889)
@@ -30,6 +30,9 @@
 import org.ofbiz.party.contact.*;
 import org.ofbiz.product.catalog.*;
 
+import javolution.util.FastMap;
+import javolution.util.FastList;
+
 delegator = request.getAttribute("delegator");
 cart = session.getAttribute("shoppingCart");
 orderPartyId = cart.getPartyId();
@@ -59,12 +62,20 @@
            context.put("orderPerson", orderPerson);
          }
     }
-    String storeId = cart.getProductStoreId();
-    GenericValue store = delegator.findByPrimaryKey("ProductStore", UtilMisc.toMap("productStoreId", storeId));
-    GenericValue facility = delegator.findByPrimaryKey("Facility", UtilMisc.toMap("facilityId", store.getString("inventoryFacilityId")));
-    context.put("facility", facility);
-    if (facility != null) {
-        List facilityContactMechValueMaps = ContactMechWorker.getFacilityContactMechValueMaps(delegator, facility.getString("facilityId"), false, null);
-        context.put("facilityContactMechList", facilityContactMechValueMaps);
+
+    String companyId = cart.getBillToCustomerPartyId();
+    if (companyId != null) {
+        List facilityMaps = FastList.newInstance();
+        List facilities = delegator.findByAndCache("Facility", UtilMisc.toMap("ownerPartyId", companyId));
+        Iterator facilitiesIt = facilities.iterator();
+        while (facilitiesIt.hasNext()) {
+            Map facilityMap = FastMap.newInstance();
+            GenericValue facility = (GenericValue)facilitiesIt.next();
+            List facilityContactMechValueMaps = ContactMechWorker.getFacilityContactMechValueMaps(delegator, facility.getString("facilityId"), false, null);
+            facilityMap.put("facilityContactMechList", facilityContactMechValueMaps);
+            facilityMap.put("facility", facility);
+            facilityMaps.add(facilityMap);
+        }
+        context.put("facilityMaps", facilityMaps);
     }
 }

Modified: trunk/applications/order/webapp/ordermgr/entry/shipsettings.ftl
===================================================================
--- trunk/applications/order/webapp/ordermgr/entry/shipsettings.ftl	2006-06-28 06:23:35 UTC (rev 7888)
+++ trunk/applications/order/webapp/ordermgr/entry/shipsettings.ftl	2006-06-28 07:20:52 UTC (rev 7889)
@@ -45,10 +45,15 @@
       <table width='100%' border='0' cellspacing='0' cellpadding='0' class='boxbottom'>
         <tr>
           <td>
-            <#if facility?exists>
+            
+            <#if facilityMaps?exists>
             <table width="100%" border="0" cellpadding="1" cellspacing="0">
               <form method="post" action="<@ofbizUrl>finalizeOrder</@ofbizUrl>" name="checkoutsetupform">
                 <input type="hidden" name="finalizeMode" value="ship">
+                <#assign i = 0>
+                <#list facilityMaps as facilityMap>
+                <#assign facility = facilityMap.facility>
+                <#assign facilityContactMechList = facilityMap.facilityContactMechList>
                 <tr>
                   <td colspan="4">
                     <div class="tableheadtext">${uiLabelMap.FacilityFacility}: ${facility.facilityName?if_exists} [${facility.facilityId}]</div>
@@ -58,7 +63,6 @@
 
                 <#-- company postal addresses -->
                 
-                <#assign i = 0>
                 <#if facilityContactMechList?has_content>
                 <#list facilityContactMechList as shippingContactMech>
                   <#if shippingContactMech.postalAddress?exists>
@@ -99,6 +103,7 @@
                       </div>
                     </td>
                 </#if>
+                </#list>
               </form>
             </table>
             <#else>



More information about the Svn mailing list