You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2012/04/01 12:36:31 UTC

svn commit: r1308065 - in /ofbiz/branches/release11.04: ./ applications/product/src/org/ofbiz/product/price/PriceServices.java

Author: jleroux
Date: Sun Apr  1 10:36:31 2012
New Revision: 1308065

URL: http://svn.apache.org/viewvc?rev=1308065&view=rev
Log:
"Applied fix from trunk for revision: 1308063" 
------------------------------------------------------------------------
r1308063 | jleroux | 2012-04-01 12:35:09 +0200 (dim., 01 avr. 2012) | 13 lines

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/branches/release11.04/   (props changed)
    ofbiz/branches/release11.04/applications/product/src/org/ofbiz/product/price/PriceServices.java

Propchange: ofbiz/branches/release11.04/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1308063

Modified: ofbiz/branches/release11.04/applications/product/src/org/ofbiz/product/price/PriceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/applications/product/src/org/ofbiz/product/price/PriceServices.java?rev=1308065&r1=1308064&r2=1308065&view=diff
==============================================================================
--- ofbiz/branches/release11.04/applications/product/src/org/ofbiz/product/price/PriceServices.java (original)
+++ ofbiz/branches/release11.04/applications/product/src/org/ofbiz/product/price/PriceServices.java Sun Apr  1 10:36:31 2012
@@ -960,6 +960,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) {