Re: svn commit: r594781 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r594781 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java

BJ Freeman
is this to fix something before branch to ver 4.0?

[hidden email] 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);
>
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r594781 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java

Scott Gray
Possibly, you could check if you wanted to, in ecommerce add a few
products to the cart as an anonymous shopper so that it goes over $50
then in the view cart screen enter the promo code 9000.  A $10
discount should be applied but if the bug exists 3 x $10 discounts
will be applied.

Regards
Scott

On 15/11/2007, BJ Freeman <[hidden email]> wrote:

> is this to fix something before branch to ver 4.0?
>
> [hidden email] 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);
> >
> >
> >
> >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r594781 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java

Jacques Le Roux
Administrator
Done in  595663

Thanks Scott for use case and BJ for reminder

Jacques

De : "Scott Gray" <[hidden email]>

> Possibly, you could check if you wanted to, in ecommerce add a few
> products to the cart as an anonymous shopper so that it goes over $50
> then in the view cart screen enter the promo code 9000.  A $10
> discount should be applied but if the bug exists 3 x $10 discounts
> will be applied.
>
> Regards
> Scott
>
> On 15/11/2007, BJ Freeman <[hidden email]> wrote:
> > is this to fix something before branch to ver 4.0?
> >
> > [hidden email] 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);
> > >
> > >
> > >
> > >
> > >
> >
>