You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Jacques Le Roux (JIRA)" <ji...@apache.org> on 2014/12/09 10:43:13 UTC
[jira] [Closed] (OFBIZ-5899) Hide useless error message related to
the "Happy hour" (9020) promotion
[ https://issues.apache.org/jira/browse/OFBIZ-5899?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jacques Le Roux closed OFBIZ-5899.
----------------------------------
Resolution: Implemented
Commited at r1644010
> Hide useless error message related to the "Happy hour" (9020) promotion
> -----------------------------------------------------------------------
>
> Key: OFBIZ-5899
> URL: https://issues.apache.org/jira/browse/OFBIZ-5899
> Project: OFBiz
> Issue Type: Improvement
> Components: product
> Affects Versions: Trunk
> Reporter: Jacques Le Roux
> Assignee: Jacques Le Roux
> Priority: Minor
>
> When you run the tests and in other cases, the "Happy hour" (9020) promotion show this error message
> {code}
> [java] 2014-12-03 09:31:31,224 |main |ProductPromoWorker |E| org.ofbiz.order.shoppingcart.product.ProductPromoWorker$UseLimitException: ERROR: While calculating promotions the
> promotion [9020] action was applied more than 0 times, so the calculation has been ended. This should generally never happen unless you have bad rule definitions.
> [java] org.ofbiz.order.shoppingcart.product.ProductPromoWorker$UseLimitException: ERROR: While calculating promotions the promotion [9020] action was applied more than 0 times, so the calculation has bee
> n ended. This should generally never happen unless you have bad rule definitions.
> [java] at org.ofbiz.order.shoppingcart.product.ProductPromoWorker.runProductPromoRules(ProductPromoWorker.java:835) ~[ofbiz-order.jar:?]
> {code}
> Though it has no real effects, it makes no sense to show such message *"action was applied more than 0 times"* So I propose to hide it in such cases where it's misleading. The patch is quite simple
> {code}
> Index: ProductPromoWorker.java
> ===================================================================
> --- ProductPromoWorker.java (revision 1643125)
> +++ ProductPromoWorker.java (working copy)
> @@ -411,6 +411,7 @@
> // set a max limit on how many times each promo can be run, for cases where there is no use limit this will be the use limit
> //default to 2 times the number of items in the cart
> long maxUseLimit = cart.getTotalQuantity().multiply(BigDecimal.valueOf(2)).setScale(0, BigDecimal.ROUND_CEILING).longValue();
> + maxUseLimit = Math.max(1, maxUseLimit);
>
> try {
> // repeat until no more rules to run: either all rules are run, or no changes to the cart in a loop
> {code}
> If nobody seems a reason to not hide this message I will commit this fix in a week...
> You can easily test it at any hour by changing the RecurrenceRule of recurrenceRuleId="205", for instance:
> <RecurrenceRule recurrenceRuleId="205" frequency="DAILY" intervalNumber="1" countNumber="-1" byHourList="8,9,10,11,12,13,14,15,16,17,18,19" byDayList="MO,TU,WE,TH,FR"/>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)