Author: jleroux
Date: Sun Apr 1 10:35:09 2012
New Revision: 1308063
URL:
http://svn.apache.org/viewvc?rev=1308063&view=revLog:
A patch from Sebastian Leitner
https://issues.apache.org/jira/browse/OFBIZ-4766 "PriceRule applies action to wrong priceType"
If you create a PriceRule and add an action of type "PRICE_POD" (Percent of default price) I read this as:
"take the default price and give an amount of x% to that"
These rules are applied within the service "calculateProductPrice" (specifically in PriceServices.calcPriceResultFromRules). It calculates the amount of discount using the default price (as specified by the action of the rule). But then it adds this discount to the listPrice instead of the defaultPrice.
An example:
listPrice = 100,
defaultPrice = 10,
rule says you give 10% of defaultPrice,
modifyAmount = -1 (this is the correct discount amount)
result would be 100-1 = 99.
Modified:
ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java
Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java?rev=1308063&r1=1308062&r2=1308063&view=diff==============================================================================
--- ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java (original)
+++ ofbiz/trunk/applications/product/src/org/ofbiz/product/price/PriceServices.java Sun Apr 1 10:35:09 2012
@@ -883,6 +883,7 @@ public class PriceServices {
if ("PRICE_POD".equals(productPriceAction.getString("productPriceActionTypeId"))) {
if (productPriceAction.get("amount") != null) {
modifyAmount = defaultPrice.multiply(productPriceAction.getBigDecimal("amount").movePointLeft(2));
+ price = defaultPrice;
}
} else if ("PRICE_POL".equals(productPriceAction.getString("productPriceActionTypeId"))) {
if (productPriceAction.get("amount") != null) {