You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by pa...@apache.org on 2014/03/11 01:30:50 UTC

svn commit: r1576153 - in /ofbiz/trunk/applications/product: servicedef/services_view.xml src/org/ofbiz/product/supplier/SupplierProductServices.java

Author: paulfoxworthy
Date: Tue Mar 11 00:30:50 2014
New Revision: 1576153

URL: http://svn.apache.org/r1576153
Log:
Minor change to service description for getSuppliersForProduct to match what the code actually does. Minor change to that service: changed order of filtering of list so the non-optional and (likely) biggest filter is applied first.

Modified:
    ofbiz/trunk/applications/product/servicedef/services_view.xml
    ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java

Modified: ofbiz/trunk/applications/product/servicedef/services_view.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services_view.xml?rev=1576153&r1=1576152&r2=1576153&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/servicedef/services_view.xml (original)
+++ ofbiz/trunk/applications/product/servicedef/services_view.xml Tue Mar 11 00:30:50 2014
@@ -90,8 +90,8 @@ under the License.
     </service>
     <service name="getSuppliersForProduct" engine="java"
             location="org.ofbiz.product.supplier.SupplierProductServices" invoke="getSuppliersForProduct">
-        <description>Finds a list of SupplierProduct entities based on either a product or, if not provided, at least a productId.
-              If partyId and currencyUomId are given, they are used to filter the list down.  Note that productId is REQUIRED, even if you are passing in a product entity.</description>
+        <description>Finds a list of SupplierProduct entity values based on a productId.
+              If other parameters are given, they are used to filter the list down.</description>
         <attribute name="productId" type="String" mode="IN" optional="false"/>
         <attribute name="partyId" type="String" mode="IN" optional="true"/>
         <attribute name="currencyUomId" type="String" mode="IN" optional="true"/>

Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java?rev=1576153&r1=1576152&r2=1576153&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/supplier/SupplierProductServices.java Tue Mar 11 00:30:50 2014
@@ -82,6 +82,9 @@ public class SupplierProductServices {
                 }
             }
 
+            // filter the list by date
+            supplierProducts = EntityUtil.filterByDate(supplierProducts, UtilDateTime.nowTimestamp(), "availableFromDate", "availableThruDate", true);
+
             // filter the list down by the partyId if one is provided
             if (partyId != null) {
                 supplierProducts = EntityUtil.filterByAnd(supplierProducts, UtilMisc.toMap("partyId", partyId));
@@ -103,9 +106,6 @@ public class SupplierProductServices {
                 supplierProducts = EntityUtil.filterByAnd(supplierProducts, UtilMisc.toMap("canDropShip", canDropShip));
             }
 
-            // filter the list down again by date before returning it
-            supplierProducts = EntityUtil.filterByDate(supplierProducts, UtilDateTime.nowTimestamp(), "availableFromDate", "availableThruDate", true);
-
             //sort resulting list of SupplierProduct entities by price in ASCENDING order
             supplierProducts = EntityUtil.orderBy(supplierProducts, UtilMisc.toList("lastPrice ASC"));