Author: lektran
Date: Sat Dec 15 20:17:56 2007
New Revision: 604551
URL:
http://svn.apache.org/viewvc?rev=604551&view=revLog:
The X Product for Y% Discount (PROMO_PROD_DISC) action wasn't checking if the action quantity had been met. Reported in the user mailing list by Raj Saini
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java?rev=604551&r1=604550&r2=604551&view=diff==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java Sat Dec 15 20:17:56 2007
@@ -1258,9 +1258,11 @@
}
}
- if (quantityDesired == startingQuantity) {
- // couldn't find any cart items to give a discount to, don't consider action run
+ if (quantityDesired == startingQuantity || quantityDesired > 0) {
+ // couldn't find any (or enough) cart items to give a discount to, don't consider action run
actionResultInfo.ranAction = false;
+ // clear out any action uses for this so they don't become part of anything else
+ cart.resetPromoRuleUse(productPromoAction.getString("productPromoId"), productPromoAction.getString("productPromoRuleId"));
} else {
double totalAmount = getCartItemsUsedTotalAmount(cart, productPromoAction);
if (Debug.verboseOn()) Debug.logVerbose("Applying promo [" + productPromoAction.getPrimaryKey() + "]\n totalAmount=" + totalAmount + ", discountAmountTotal=" + discountAmountTotal, module);