svn commit: r418915 - /incubator/ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java

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

svn commit: r418915 - /incubator/ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java

jonesde
Author: jonesde
Date: Mon Jul  3 22:05:40 2006
New Revision: 418915

URL: http://svn.apache.org/viewvc?rev=418915&view=rev
Log:
Changed the checkPriceCondition method to accept a null quantity and in that circumstance ignore quantity constraints, in preparation for other methods to find quantity breaks and such for a product according to the price rules

Modified:
    incubator/ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java

Modified: incubator/ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java?rev=418915&r1=418914&r2=418915&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java (original)
+++ incubator/ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java Mon Jul  3 22:05:40 2006
@@ -700,10 +700,10 @@
 
                         totalConds++;
 
-                        if (!checkPriceCondition(productPriceCond, productId, prodCatalogId, productStoreGroupId, webSiteId, partyId, quantity, listPrice, currencyUomId, delegator)) {
+                        if (!checkPriceCondition(productPriceCond, productId, prodCatalogId, productStoreGroupId, webSiteId, partyId, new Double(quantity), listPrice, currencyUomId, delegator)) {
                             // if there is a virtualProductId, try that given that this one has failed
                             if (virtualProductId != null) {
-                                if (!checkPriceCondition(productPriceCond, virtualProductId, prodCatalogId, productStoreGroupId, webSiteId, partyId, quantity, listPrice, currencyUomId, delegator)) {
+                                if (!checkPriceCondition(productPriceCond, virtualProductId, prodCatalogId, productStoreGroupId, webSiteId, partyId, new Double(quantity), listPrice, currencyUomId, delegator)) {
                                     allTrue = false;
                                     break;
                                 }
@@ -958,7 +958,7 @@
     }
 
     public static boolean checkPriceCondition(GenericValue productPriceCond, String productId, String prodCatalogId,
-            String productStoreGroupId, String webSiteId, String partyId, double quantity, double listPrice,
+            String productStoreGroupId, String webSiteId, String partyId, Double quantity, double listPrice,
             String currencyUomId, GenericDelegator delegator) throws GenericEntityException {
         if (Debug.verboseOn()) Debug.logVerbose("Checking price condition: " + productPriceCond, module);
         int compare = 0;
@@ -998,8 +998,12 @@
                 compare = 1;
             }
         } else if ("PRIP_QUANTITY".equals(productPriceCond.getString("inputParamEnumId"))) {
-            Double quantityValue = new Double(quantity);
-            compare = quantityValue.compareTo(Double.valueOf(productPriceCond.getString("condValue")));
+            if (quantity == null) {
+                // if no quantity is passed in, assume all quantity conditions pass
+                compare = 0;
+            } else {
+                compare = quantity.compareTo(Double.valueOf(productPriceCond.getString("condValue")));
+            }
         } else if ("PRIP_PARTY_ID".equals(productPriceCond.getString("inputParamEnumId"))) {
             if (UtilValidate.isNotEmpty(partyId)) {
                 compare = partyId.compareTo(productPriceCond.getString("condValue"));