svn commit: r583911 - in /ofbiz/trunk/applications: order/webapp/ordermgr/WEB-INF/actions/entry/showcart.bsh product/servicedef/services_facility.xml product/src/org/ofbiz/product/inventory/InventoryServices.java

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

svn commit: r583911 - in /ofbiz/trunk/applications: order/webapp/ordermgr/WEB-INF/actions/entry/showcart.bsh product/servicedef/services_facility.xml product/src/org/ofbiz/product/inventory/InventoryServices.java

sichen
Author: sichen
Date: Thu Oct 11 11:43:36 2007
New Revision: 583911

URL: http://svn.apache.org/viewvc?rev=583911&view=rev
Log:
Changed showcart to show only inventory of the store's facility rather than all facilities

Modified:
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/showcart.bsh
    ofbiz/trunk/applications/product/servicedef/services_facility.xml
    ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/showcart.bsh
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/showcart.bsh?rev=583911&r1=583910&r2=583911&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/showcart.bsh (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/showcart.bsh Thu Oct 11 11:43:36 2007
@@ -76,7 +76,12 @@
 }
 
 // get product inventory summary for each shopping cart item
-inventorySummary = dispatcher.runSync("getProductInventorySummaryForItems", UtilMisc.toMap("orderItems", shoppingCart.makeOrderItems()));
+productStore = delegator.findByPrimaryKeyCache("ProductStore", UtilMisc.toMap("productStoreId", shoppingCart.getProductStoreId()));
+productStoreFacilityId = null;
+if (productStore != null) {
+    productStoreFacilityId = productStore.getString("inventoryFacilityId");
+}
+inventorySummary = dispatcher.runSync("getProductInventorySummaryForItems", UtilMisc.toMap("orderItems", shoppingCart.makeOrderItems(), "facilityId", productStoreFacilityId));
 context.put("availableToPromiseMap", inventorySummary.get("availableToPromiseMap"));
 context.put("quantityOnHandMap", inventorySummary.get("quantityOnHandMap"));
 context.put("mktgPkgATPMap", inventorySummary.get("mktgPkgATPMap"));

Modified: ofbiz/trunk/applications/product/servicedef/services_facility.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_facility.xml?rev=583911&r1=583910&r2=583911&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_facility.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_facility.xml Thu Oct 11 11:43:36 2007
@@ -194,6 +194,7 @@
         <description>Get ATP/QOH Availability for a list of OrderItems by summing over all facilities.  If the item is a MARKETING_PKG_AUTO/PICK, then put its quantity available from components
             in the mktgPkgATPMap and mktgPkgQOHMap.</description>
         <attribute name="orderItems" type="List" mode="IN" optional="false"/>
+        <attribute name="facilityId" type="String" mode="IN" optional="true"/>
         <attribute name="quantityOnHandMap" type="Map" mode="OUT" optional="false"/>
         <attribute name="availableToPromiseMap" type="Map" mode="OUT" optional="false"/>
         <attribute name="mktgPkgQOHMap" type="Map" mode="OUT" optional="false"/>

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java?rev=583911&r1=583910&r2=583911&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/inventory/InventoryServices.java Thu Oct 11 11:43:36 2007
@@ -701,6 +701,7 @@
         GenericDelegator delegator = dctx.getDelegator();
         LocalDispatcher dispatcher = dctx.getDispatcher();
         List orderItems = (List) context.get("orderItems");
+        String facilityId = (String) context.get("facilityId");
         Map atpMap = new HashMap();
         Map qohMap = new HashMap();
         Map mktgPkgAtpMap = new HashMap();
@@ -709,11 +710,14 @@
 
         // get a list of all available facilities for looping
         List facilities = null;
-        try {
-            facilities = delegator.findAll("Facility");
+ try {
+    if (facilityId != null) {
+                facilities = delegator.findByAnd("Facility", UtilMisc.toMap("facilityId", facilityId));
+            } else {
+                facilities = delegator.findAll("Facility");
+            }
         } catch (GenericEntityException e) {
-            Debug.logError(e, "Couldn't get list of facilities.", module);
-            return ServiceUtil.returnError("Unable to locate facilities.");
+            return ServiceUtil.returnError("Unable to locate facilities." + e.getMessage());
         }
 
         // loop through all the order items