is this to fix something before branch to ver 4.0?
[EMAIL PROTECTED] sent the following on 11/13/2007 9:56 PM: > Author: lektran > Date: Tue Nov 13 21:56:16 2007 > New Revision: 594781 > > URL: http://svn.apache.org/viewvc?rev=594781&view=rev > Log: > Promo Code's use limit per customer was not being honoured for anonymous > shoppers, resulted in a promotion being applied to the cart multiple times > (up to the promo code use limit) > > 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=594781&r1=594780&r2=594781&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 > Tue Nov 13 21:56:16 2007 > @@ -485,14 +485,17 @@ > > // check promo code use limits, per customer, code > Long codeUseLimitPerCustomer = > productPromoCode.getLong("useLimitPerCustomer"); > - if (codeUseLimitPerCustomer != null && > UtilValidate.isNotEmpty(partyId)) { > - // check to see how many times this has been used for other > orders for this customer, the remainder is the limit for this order > - EntityCondition checkCondition = new > EntityConditionList(UtilMisc.toList( > - new EntityExpr("productPromoCodeId", > EntityOperator.EQUALS, productPromoCodeId), > - new EntityExpr("partyId", EntityOperator.EQUALS, > partyId), > - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, > "ORDER_REJECTED"), > - new EntityExpr("statusId", EntityOperator.NOT_EQUAL, > "ORDER_CANCELLED")), EntityOperator.AND); > - long productPromoCustomerUseSize = > delegator.findCountByCondition("ProductPromoUseCheck", checkCondition, null); > + if (codeUseLimitPerCustomer != null) { > + long productPromoCustomerUseSize = 0; > + if (UtilValidate.isNotEmpty(partyId)) { > + // check to see how many times this has been used for other > orders for this customer, the remainder is the limit for this order > + EntityCondition checkCondition = new > EntityConditionList(UtilMisc.toList( > + new EntityExpr("productPromoCodeId", > EntityOperator.EQUALS, productPromoCodeId), > + new EntityExpr("partyId", EntityOperator.EQUALS, > partyId), > + new EntityExpr("statusId", EntityOperator.NOT_EQUAL, > "ORDER_REJECTED"), > + new EntityExpr("statusId", EntityOperator.NOT_EQUAL, > "ORDER_CANCELLED")), EntityOperator.AND); > + productPromoCustomerUseSize = > delegator.findCountByCondition("ProductPromoUseCheck", checkCondition, null); > + } > long perCustomerThisOrder = codeUseLimitPerCustomer.longValue() > - productPromoCustomerUseSize; > if (codeUseLimit == null || codeUseLimit.longValue() > > perCustomerThisOrder) { > codeUseLimit = new Long(perCustomerThisOrder); > > > > >
