You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by bi...@apache.org on 2008/01/03 00:40:29 UTC
svn commit: r608283 -
/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
Author: bibryam
Date: Wed Jan 2 15:40:27 2008
New Revision: 608283
URL: http://svn.apache.org/viewvc?rev=608283&view=rev
Log:
Applied (modified) patch from Rashko Rejmer, OFBIZ-1520: "X Product for Y%" promo action does not calculate properly discounts for rental order items.
I also fixed the same bug for the other promotion actions.
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=608283&r1=608282&r2=608283&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 Wed Jan 2 15:40:27 2008
@@ -1250,7 +1250,7 @@
// create an adjustment and add it to the cartItem that implements the promotion action
double percentModifier = productPromoAction.get("amount") == null ? 0.0 : (productPromoAction.getDouble("amount").doubleValue()/100.0);
- double lineAmount = quantityUsed * cartItem.getBasePrice();
+ double lineAmount = quantityUsed * cartItem.getBasePrice() * cartItem.getRentalAdjustment();
double discountAmount = -(lineAmount * percentModifier);
discountAmountTotal += discountAmount;
// not doing this any more, now distributing among conditions and actions (see call below): doOrderItemPromoAction(productPromoAction, cartItem, discountAmount, "amount", delegator);
@@ -1295,8 +1295,8 @@
// create an adjustment and add it to the cartItem that implements the promotion action
double discount = productPromoAction.get("amount") == null ? 0.0 : productPromoAction.getDouble("amount").doubleValue();
// don't allow the discount to be greater than the price
- if (discount > cartItem.getBasePrice()) {
- discount = cartItem.getBasePrice();
+ if (discount > cartItem.getBasePrice() * cartItem.getRentalAdjustment()) {
+ discount = cartItem.getBasePrice() * cartItem.getRentalAdjustment();
}
double discountAmount = -(quantityUsed * discount);
discountAmountTotal += discountAmount;
@@ -1337,7 +1337,7 @@
double quantityUsed = cartItem.addPromoQuantityCandidateUse(quantityDesired, productPromoAction, false);
if (quantityUsed > 0) {
quantityDesired -= quantityUsed;
- totalAmount += quantityUsed * cartItem.getBasePrice();
+ totalAmount += quantityUsed * cartItem.getBasePrice() * cartItem.getRentalAdjustment();
cartItemsUsed.add(cartItem);
}
}
@@ -1396,7 +1396,7 @@
}
// get difference between basePrice and specialPromoPrice and adjust for that
- double difference = -(cartItem.getBasePrice() - cartItem.getSpecialPromoPrice().doubleValue());
+ double difference = -(cartItem.getBasePrice() * cartItem.getRentalAdjustment() - cartItem.getSpecialPromoPrice().doubleValue());
if (difference != 0.0) {
double quantityUsed = cartItem.addPromoQuantityCandidateUse(cartItem.getQuantity(), productPromoAction, false);