You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by as...@apache.org on 2011/07/19 07:44:00 UTC

svn commit: r1148183 - in /ofbiz/branches/release11.04/applications/order: entitydef/entitymodel_view.xml src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java

Author: ashish
Date: Tue Jul 19 05:44:00 2011
New Revision: 1148183

URL: http://svn.apache.org/viewvc?rev=1148183&view=rev
Log:
Applied fix from trunk r1148180.
Applied patch from jira issue - OFBIZ-4343.

When user tries to apply the specified promotion then following problem occurs;
1) Promotion is not applying for the customer, that means customer do not get the discount even if any promotion of such kind exists for the user.
1.1) To fix the above will need to add group-by clause to 2 more fields orderTypeId and statusId of view entity OrderHeaderAndRoleSummary as these fields do not have any values to check the condition, as group-by clause do not allow to show them if values are different.
2) After fixing the issue explained in #1, if user pass the other_value as 12 (month) and condVlaue as $ 1000.00, then after $ 1000 if user order history is of $ 900. Then it will pass the check and then user is allow to get discount on any number on the last order.
3) That means even if the limit is 1000 user is able to purchase in discount of 900 + 300 >> 1200 amount with complete discount. So before checking for the total amount on order history now system will check for "order history + cart sub total".

Thanks Rishi for the contribution!

Modified:
    ofbiz/branches/release11.04/applications/order/entitydef/entitymodel_view.xml
    ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java

Modified: ofbiz/branches/release11.04/applications/order/entitydef/entitymodel_view.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/applications/order/entitydef/entitymodel_view.xml?rev=1148183&r1=1148182&r2=1148183&view=diff
==============================================================================
--- ofbiz/branches/release11.04/applications/order/entitydef/entitymodel_view.xml (original)
+++ ofbiz/branches/release11.04/applications/order/entitydef/entitymodel_view.xml Tue Jul 19 05:44:00 2011
@@ -146,9 +146,9 @@ under the License.
       <alias entity-alias="ORLE" name="partyId" group-by="true"/>
       <alias entity-alias="ORLE" name="roleTypeId" group-by="true"/>
       <alias entity-alias="OH" name="orderId"/>
-      <alias entity-alias="OH" name="orderTypeId"/>
+      <alias entity-alias="OH" name="orderTypeId" group-by="true"/>
       <alias entity-alias="OH" name="orderDate"/>
-      <alias entity-alias="OH" name="statusId"/>
+      <alias entity-alias="OH" name="statusId" group-by="true"/>
       <alias entity-alias="OH" name="totalGrandAmount" field="grandTotal" function="sum"/>
       <alias entity-alias="OH" name="totalSubRemainingAmount" field="remainingSubTotal" function="sum"/>
       <alias entity-alias="OH" name="totalOrders" field="orderId" function="count"/>

Modified: ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java?rev=1148183&r1=1148182&r2=1148183&view=diff
==============================================================================
--- ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java (original)
+++ ofbiz/branches/release11.04/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java Tue Jul 19 05:44:00 2011
@@ -1122,8 +1122,9 @@ public class ProductPromoWorker {
                         return false;
                     } else {
                         BigDecimal orderSubTotal = (BigDecimal) result.get("totalSubRemainingAmount");
+                        BigDecimal orderSubTotalAndCartSubTotal = orderSubTotal.add(cart.getSubTotal()); 
                         if (Debug.verboseOn()) Debug.logVerbose("Doing order history sub-total compare: orderSubTotal=" + orderSubTotal + ", for the last " + monthsToInclude + " months.", module);
-                        compareBase = Integer.valueOf(orderSubTotal.compareTo(new BigDecimal(condValue)));
+                        compareBase = Integer.valueOf(orderSubTotalAndCartSubTotal.compareTo(new BigDecimal(condValue)));
                     }
                 } catch (GenericServiceException e) {
                     Debug.logError(e, "Error getting order history sub-total in the getOrderedSummaryInformation service, evaluating condition to false.", module);