svn commit: r757091 [5/6] - in /ofbiz/trunk/applications/order/src/org/ofbiz/order: ./ finaccount/ order/ quote/ requirement/ shoppingcart/ shoppingcart/product/ shoppingcart/shipping/ shoppinglist/ task/ test/ thirdparty/taxware/ thirdparty/zipsales/

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

svn commit: r757091 [5/6] - in /ofbiz/trunk/applications/order/src/org/ofbiz/order: ./ finaccount/ order/ quote/ requirement/ shoppingcart/ shoppingcart/product/ shoppingcart/shipping/ shoppinglist/ task/ test/ thirdparty/taxware/ thirdparty/zipsales/

doogie-3
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=757091&r1=757090&r2=757091&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 Sat Mar 21 23:44:41 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -72,7 +72,7 @@
 
     public static final int decimals = UtilNumber.getBigDecimalScale("order.decimals");
     public static final int rounding = UtilNumber.getBigDecimalRoundingMode("order.rounding");
-    
+
     public static final MathContext generalRounding = new MathContext(10);
 
     public static List getStoreProductPromos(GenericDelegator delegator, LocalDispatcher dispatcher, ServletRequest request) {
@@ -156,7 +156,7 @@
 
     public static List getProductStorePromotions(ShoppingCart cart, Timestamp nowTimestamp, LocalDispatcher dispatcher) {
         List productPromoList = FastList.newInstance();
-        
+
         GenericDelegator delegator = cart.getDelegator();
 
         String productStoreId = cart.getProductStoreId();
@@ -199,7 +199,7 @@
 
     public static List getAgreementPromotions(ShoppingCart cart, Timestamp nowTimestamp, LocalDispatcher dispatcher) {
         List productPromoList = FastList.newInstance();
-        
+
         GenericDelegator delegator = cart.getDelegator();
 
         String agreementId = cart.getAgreementId();
@@ -256,13 +256,13 @@
         // ProductPromoUses are ignored if the corresponding order is cancelled
         // limits sub total for promos to not use gift cards (products with a don't use in promo indicator), also exclude gift cards from all other promotion considerations including subTotals for discounts, etc
         // TODO: (not done, delay, still considering...) add code to check ProductPromoUse limits per promo (customer, promo), and per code (customer, code) to avoid use of promos or codes getting through due to multiple carts getting promos applied at the same time, possibly on totally different servers
-        
+
         GenericDelegator delegator = cart.getDelegator();
         Timestamp nowTimestamp = UtilDateTime.nowTimestamp();
 
         // start out by clearing all existing promotions, then we can just add all that apply
         cart.clearAllPromotionInformation();
-        
+
         // there will be a ton of db access, so just do a big catch entity exception block
         try {
             if (productPromoList == null) {
@@ -274,14 +274,14 @@
             }
             // do a calculate only run through the promotions, then order by descending totalDiscountAmount for each promotion
             // NOTE: on this run, with isolatedTestRun passed as false it should not apply any adjustments
-            //  or track which cart items are used for which promotions, but it will track ProductPromoUseInfo and
+            //  or track which cart items are used for which promotions, but it will track ProductPromoUseInfo and
             //  useLimits; we are basicly just trying to run each promo "independently" to see how much each is worth
             runProductPromos(productPromoList, cart, delegator, dispatcher, nowTimestamp, true);
-            
+
             // NOTE: after that first pass we could remove any that have a 0 totalDiscountAmount from the run list, but we won't because by the time they are run the cart may have changed enough to get them to go; also, certain actions like free shipping should always be run even though we won't know what the totalDiscountAmount is at the time the promotion is run
             // each ProductPromoUseInfo on the shopping cart will contain it's total value, so add up all totals for each promoId and put them in a List of Maps
             // create a List of Maps with productPromo and totalDiscountAmount, use the Map sorter to sort them descending by totalDiscountAmount
-            
+
             // before sorting split into two lists and sort each list; one list for promos that have a order total condition, and the other list for all promos that don't; then we'll always run the ones that have no condition on the order total first
             List productPromoDiscountMapList = FastList.newInstance();
             List productPromoDiscountMapListOrderTotal = FastList.newInstance();
@@ -295,14 +295,14 @@
                     productPromoDiscountMapList.add(productPromoDiscountMap);
                 }
             }
-            
-            
+
+
             // sort the Map List, do it ascending because the discount amounts will be negative, so the lowest number is really the highest discount
             productPromoDiscountMapList = UtilMisc.sortMaps(productPromoDiscountMapList, UtilMisc.toList("+totalDiscountAmount"));
             productPromoDiscountMapListOrderTotal = UtilMisc.sortMaps(productPromoDiscountMapListOrderTotal, UtilMisc.toList("+totalDiscountAmount"));
 
             productPromoDiscountMapList.addAll(productPromoDiscountMapListOrderTotal);
-            
+
             List sortedProductPromoList = new ArrayList(productPromoDiscountMapList.size());
             Iterator productPromoDiscountMapIter = productPromoDiscountMapList.iterator();
             while (productPromoDiscountMapIter.hasNext()) {
@@ -311,7 +311,7 @@
                 sortedProductPromoList.add(productPromo);
                 if (Debug.verboseOn()) Debug.logVerbose("Sorted Promo [" + productPromo.getString("productPromoId") + "] with total discount: " + productPromoDiscountMap.get("totalDiscountAmount"), module);
             }
-            
+
             // okay, all ready, do the real run, clearing the temporary result first...
             cart.clearAllPromotionInformation();
             runProductPromos(sortedProductPromoList, cart, delegator, dispatcher, nowTimestamp, false);
@@ -338,7 +338,7 @@
         }
         return hasOtCond;
     }
-    
+
     protected static void runProductPromos(List productPromoList, ShoppingCart cart, GenericDelegator delegator, LocalDispatcher dispatcher, Timestamp nowTimestamp, boolean isolatedTestRun) throws GeneralException {
         String partyId = cart.getPartyId();
 
@@ -346,11 +346,11 @@
         long maxIterations = 1000;
         // part of the safety net to avoid infinite iteration
         long numberOfIterations = 0;
-        
+
         // 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();
-        
+
         try {
             // repeat until no more rules to run: either all rules are run, or no changes to the cart in a loop
             boolean cartChanged = true;
@@ -393,7 +393,7 @@
                                     if (runProductPromoRules(cart, cartChanged, useLimit, true, productPromoCodeId, codeUseLimit, maxUseLimit, productPromo, productPromoRules, dispatcher, delegator, nowTimestamp)) {
                                         cartChanged = true;
                                     }
-                                    
+
                                     if (cart.getProductPromoUseCount(productPromoId) > maxUseLimit) {
                                         Debug.logError("ERROR: While calculating promotions the promotion [" + productPromoId + "] action was applied more than " + maxUseLimit + " times, so the calculation has been ended. This should generally never happen unless you have bad rule definitions.", module);
                                         break;
@@ -410,14 +410,14 @@
                             }
                         }
                     }
-                    
+
                     // if this is an isolatedTestRun clear out adjustments and cart item promo use info
                     if (isolatedTestRun) {
                         cart.clearAllPromotionAdjustments();
                         cart.clearCartItemUseInPromoInfo();
                     }
                 }
-                
+
                 // if this is an isolatedTestRun, then only go through it once, never retry
                 if (isolatedTestRun) {
                     cartChanged = false;
@@ -439,7 +439,7 @@
                 candidateUseLimit = useLimitPerOrder;
             }
         }
-        
+
         // Debug.logInfo("Promo [" + productPromoId + "] use limit after per order check: " + candidateUseLimit, module);
 
         Long useLimitPerCustomer = productPromo.getLong("useLimitPerCustomer");
@@ -522,7 +522,7 @@
 
         return codeUseLimit;
     }
-    
+
     public static String checkCanUsePromoCode(String productPromoCodeId, String partyId, GenericDelegator delegator) {
         try {
             GenericValue productPromoCode = delegator.findByPrimaryKey("ProductPromoCode", UtilMisc.toMap("productPromoCodeId", productPromoCodeId));
@@ -540,43 +540,43 @@
                     return "The promotion code [" + productPromoCodeId + "] will be activated in: " + productPromoCode.getTimestamp("fromDate");
                 }
             }
-            
+
             if ("Y".equals(productPromoCode.getString("requireEmailOrParty"))) {
                 boolean hasEmailOrParty = false;
-                
+
                 // check partyId
                 if (UtilValidate.isNotEmpty(partyId)) {
                     if (delegator.findByPrimaryKey("ProductPromoCodeParty", UtilMisc.toMap("productPromoCodeId", productPromoCodeId, "partyId", partyId)) != null) {
                         // found party associated with the code, looks good...
                         return null;
                     }
-                    
+
                     // check email address in ProductPromoCodeEmail
                     List validEmailCondList = new ArrayList();
                     validEmailCondList.add(EntityCondition.makeCondition("partyId", EntityOperator.EQUALS, partyId));
                     validEmailCondList.add(EntityCondition.makeCondition("productPromoCodeId", EntityOperator.EQUALS, productPromoCodeId));
                     validEmailCondList.add(EntityCondition.makeCondition("fromDate", EntityOperator.LESS_THAN_EQUAL_TO, nowTimestamp));
-                    validEmailCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp),
+                    validEmailCondList.add(EntityCondition.makeCondition(EntityCondition.makeCondition("thruDate", EntityOperator.GREATER_THAN_EQUAL_TO, nowTimestamp),
                             EntityOperator.OR, EntityCondition.makeCondition("thruDate", EntityOperator.EQUALS, null)));
                     EntityCondition validEmailCondition = EntityCondition.makeCondition(validEmailCondList, EntityOperator.AND);
                     long validEmailCount = delegator.findCountByCondition("ProductPromoCodeEmailParty", validEmailCondition, null, null);
                     if (validEmailCount > 0) {
-                        // there was an email in the list, looks good...
+                        // there was an email in the list, looks good...
                         return null;
                     }
                 }
-                
+
                 if (!hasEmailOrParty) {
                     return "This promotion code [" + productPromoCodeId + "] requires you to be associated with it by account or email address and you are not associated with it.";
                 }
             }
-            
+
             // check per customer and per promotion code use limits
             Long useLimit = getProductPromoCodeUseLimit(productPromoCode, partyId, delegator);
             if (useLimit != null && useLimit.longValue() <= 0) {
                 return "This promotion code [" + productPromoCodeId + "] has reached it's maximum use limit for you and can no longer be used.";
             }
-            
+
             return null;
         } catch (GenericEntityException e) {
             Debug.logError(e, "Error looking up ProductPromoCode", module);
@@ -608,12 +608,12 @@
                 if (UtilValidate.isNotEmpty(productPromoCond.getString("condValue"))) {
                     condValue = productPromoCond.getString("condValue");
                 }
-                
+
                 Map messageContext = UtilMisc.toMap("condValue", condValue, "equalityOperator", equalityOperator, "quantityOperator", quantityOperator);
                 String msgProp = UtilProperties.getMessage("promotext", "condition." + productPromoCond.getString("inputParamEnumId"), messageContext, locale);
                 promoDescBuf.append(msgProp);
                 promoDescBuf.append(" ");
-                
+
                 if (promoRulesIter.hasNext()) {
                     promoDescBuf.append(" and ");
                 }
@@ -625,7 +625,7 @@
                 GenericValue productPromoAction = (GenericValue) productPromoActionIter.next();
 
                 String productId = productPromoAction.getString("productId");
-                
+
                 Map messageContext = UtilMisc.toMap("quantity", productPromoAction.get("quantity"), "amount", productPromoAction.get("amount"), "productId", productId, "partyId", productPromoAction.get("partyId"));
 
                 if (UtilValidate.isEmpty((String) messageContext.get("productId"))) messageContext.put("productId", "any");
@@ -634,16 +634,16 @@
                 if (product != null) {
                     messageContext.put("productName", ProductContentWrapper.getProductContentAsText(product, "PRODUCT_NAME", locale, null));
                 }
-                
+
                 String msgProp = UtilProperties.getMessage("promotext", "action." + productPromoAction.getString("productPromoActionEnumId"), messageContext, locale);
                 promoDescBuf.append(msgProp);
                 promoDescBuf.append(" ");
-                
+
                 if (promoRulesIter.hasNext()) {
                     promoDescBuf.append(" and ");
                 }
             }
-            
+
             if (promoRulesIter.hasNext()) {
                 promoDescBuf.append(" or ");
             }
@@ -657,7 +657,7 @@
             // capitalize the first letter
             promoDescBuf.setCharAt(0, Character.toUpperCase(promoDescBuf.charAt(0)));
         }
-        
+
         if ("Y".equals(productPromo.getString("requireCode"))) {
             promoDescBuf.append("Requires code to use. ");
         }
@@ -676,10 +676,10 @@
             promoDescBuf.append(productPromo.getLong("useLimitPerPromotion"));
             promoDescBuf.append(" per promotion. ");
         }
-        
+
         return promoDescBuf.toString();
     }
-    
+
     protected static boolean runProductPromoRules(ShoppingCart cart, boolean cartChanged, Long useLimit, boolean requireCode, String productPromoCodeId, Long codeUseLimit, long maxUseLimit,
             GenericValue productPromo, List productPromoRules, LocalDispatcher dispatcher, GenericDelegator delegator, Timestamp nowTimestamp) throws GenericEntityException, UseLimitException {
         String productPromoId = productPromo.getString("productPromoId");
@@ -730,7 +730,7 @@
                             ActionResultInfo actionResultInfo = performAction(productPromoAction, cart, delegator, dispatcher, nowTimestamp);
                             totalDiscountAmount = totalDiscountAmount.add(actionResultInfo.totalDiscountAmount);
                             quantityLeftInActions = quantityLeftInActions.add(actionResultInfo.quantityLeftInAction);
-                            
+
                             // only set if true, don't set back to false: implements OR logic (ie if ANY actions change content, redo loop)
                             boolean actionChangedCart = actionResultInfo.ranAction;
                             if (actionChangedCart) {
@@ -751,7 +751,7 @@
                 break;
             }
 
-            
+
             if (cart.getProductPromoUseCount(productPromoId) > maxUseLimit) {
                 throw new UseLimitException("ERROR: While calculating promotions the promotion [" + productPromoId + "] action was applied more than " + maxUseLimit + " times, so the calculation has been ended. This should generally never happen unless you have bad rule definitions.");
             }
@@ -778,7 +778,7 @@
         if ("PPIP_PRODUCT_AMOUNT".equals(inputParamEnumId)) {
             // for this type of promo force the operatorEnumId = PPC_EQ, effectively ignore that setting because the comparison is implied in the code
             operatorEnumId = "PPC_EQ";
-            
+
             // this type of condition requires items involved to not be involved in any other quantity consuming cond/action, and does not pro-rate the price, just uses the base price
             BigDecimal amountNeeded = BigDecimal.ZERO;
             if (UtilValidate.isNotEmpty(condValue)) {
@@ -786,7 +786,7 @@
             }
 
             // Debug.logInfo("Doing Amount Cond with Value: " + amountNeeded, module);
-            
+
             Set productIds = ProductPromoWorker.getPromoRuleCondProductIds(productPromoCond, delegator, nowTimestamp);
 
             List lineOrderedByBasePriceList = cart.getLineListOrderedByBasePrice(false);
@@ -796,14 +796,14 @@
                 // only include if it is in the productId Set for this check and if it is not a Promo (GWP) item
                 GenericValue product = cartItem.getProduct();
                 String parentProductId = cartItem.getParentProductId();
-                if (!cartItem.getIsPromo() &&
-                        (productIds.contains(cartItem.getProductId()) || (parentProductId != null && productIds.contains(parentProductId))) &&
+                if (!cartItem.getIsPromo() &&
+                        (productIds.contains(cartItem.getProductId()) || (parentProductId != null && productIds.contains(parentProductId))) &&
                         (product == null || !"N".equals(product.getString("includeInPromotions")))) {
-                    
+
                     BigDecimal basePrice = cartItem.getBasePrice();
                     // get a rough price, round it up to an integer
                     BigDecimal quantityNeeded = amountNeeded.divide(basePrice, generalRounding).setScale(0, BigDecimal.ROUND_CEILING);
-                    
+
                     // reduce amount still needed to qualify for promo (amountNeeded)
                     BigDecimal quantity = cartItem.addPromoQuantityCandidateUse(quantityNeeded, productPromoCond, false);
                     // get pro-rated amount based on discount
@@ -812,7 +812,7 @@
             }
 
             // Debug.logInfo("Doing Amount Cond with Value after finding applicable cart lines: " + amountNeeded, module);
-            
+
             // if amountNeeded > 0 then the promo condition failed, so remove candidate promo uses and increment the promoQuantityUsed to restore it
             if (amountNeeded.compareTo(BigDecimal.ZERO) > 0) {
                 // failed, reset the entire rule, ie including all other conditions that might have been done before
@@ -829,7 +829,7 @@
             BigDecimal amountAvailable = BigDecimal.ZERO;
 
             // Debug.logInfo("Doing Amount Not Counted Cond with Value: " + amountNeeded, module);
-            
+
             Set productIds = ProductPromoWorker.getPromoRuleCondProductIds(productPromoCond, delegator, nowTimestamp);
 
             List lineOrderedByBasePriceList = cart.getLineListOrderedByBasePrice(false);
@@ -839,22 +839,22 @@
                 // only include if it is in the productId Set for this check and if it is not a Promo (GWP) item
                 GenericValue product = cartItem.getProduct();
                 String parentProductId = cartItem.getParentProductId();
-                if (!cartItem.getIsPromo() &&
-                        (productIds.contains(cartItem.getProductId()) || (parentProductId != null && productIds.contains(parentProductId))) &&
+                if (!cartItem.getIsPromo() &&
+                        (productIds.contains(cartItem.getProductId()) || (parentProductId != null && productIds.contains(parentProductId))) &&
                         (product == null || !"N".equals(product.getString("includeInPromotions")))) {
-                    
+
                     // just count the entire sub-total of the item
                     amountAvailable = amountAvailable.add(cartItem.getItemSubTotal());
                 }
             }
 
             // Debug.logInfo("Doing Amount Not Counted Cond with Value after finding applicable cart lines: " + amountNeeded, module);
-            
+
             compareBase = new Integer(amountAvailable.compareTo(amountNeeded));
         } else if ("PPIP_PRODUCT_QUANT".equals(inputParamEnumId)) {
             // for this type of promo force the operatorEnumId = PPC_EQ, effectively ignore that setting because the comparison is implied in the code
             operatorEnumId = "PPC_EQ";
-            
+
             BigDecimal quantityNeeded = BigDecimal.ONE;
             if (UtilValidate.isNotEmpty(condValue)) {
                 quantityNeeded = new BigDecimal(condValue);
@@ -869,8 +869,8 @@
                 // only include if it is in the productId Set for this check and if it is not a Promo (GWP) item
                 GenericValue product = cartItem.getProduct();
                 String parentProductId = cartItem.getParentProductId();
-                if (!cartItem.getIsPromo() &&
-                        (productIds.contains(cartItem.getProductId()) || (parentProductId != null && productIds.contains(parentProductId))) &&
+                if (!cartItem.getIsPromo() &&
+                        (productIds.contains(cartItem.getProductId()) || (parentProductId != null && productIds.contains(parentProductId))) &&
                         (product == null || !"N".equals(product.getString("includeInPromotions")))) {
                     // reduce quantity still needed to qualify for promo (quantityNeeded)
                     quantityNeeded = quantityNeeded.subtract(cartItem.addPromoQuantityCandidateUse(quantityNeeded, productPromoCond, false));
@@ -1045,12 +1045,12 @@
                 // call the getOrderedSummaryInformation service to get the sub-total
                 Calendar calendar = Calendar.getInstance();
                 calendar.setTime(nowTimestamp);
-                int monthsToInclude = calendar.get(Calendar.MONTH) + 1;                
-                Map serviceIn = UtilMisc.toMap("partyId", partyId,
-                        "roleTypeId", "PLACING_CUSTOMER",
-                        "orderTypeId", "SALES_ORDER",
-                        "statusId", "ORDER_COMPLETED",
-                        "monthsToInclude", new Integer(monthsToInclude),
+                int monthsToInclude = calendar.get(Calendar.MONTH) + 1;
+                Map serviceIn = UtilMisc.toMap("partyId", partyId,
+                        "roleTypeId", "PLACING_CUSTOMER",
+                        "orderTypeId", "SALES_ORDER",
+                        "statusId", "ORDER_COMPLETED",
+                        "monthsToInclude", new Integer(monthsToInclude),
                         "userLogin", userLogin);
                 try {
                     Map result = dispatcher.runSync("getOrderedSummaryInformation", serviceIn);
@@ -1071,22 +1071,22 @@
             // description="Order sub-total X since beginning of last year"
             if (partyId != null && userLogin != null) {
                 // call the getOrderedSummaryInformation service to get the sub-total
-                
+
                 Calendar calendar = Calendar.getInstance();
                 calendar.setTime(nowTimestamp);
-                int lastYear = calendar.get(Calendar.YEAR) - 1;              
+                int lastYear = calendar.get(Calendar.YEAR) - 1;
                 Calendar fromDateCalendar = Calendar.getInstance();
                 fromDateCalendar.set(lastYear, 0, 0, 0, 0);
-                Timestamp fromDate = new Timestamp(fromDateCalendar.getTime().getTime());  
+                Timestamp fromDate = new Timestamp(fromDateCalendar.getTime().getTime());
                 Calendar thruDateCalendar = Calendar.getInstance();
                 thruDateCalendar.set(lastYear, 12, 0, 0, 0);
-                Timestamp thruDate = new Timestamp(thruDateCalendar.getTime().getTime());  
-                Map serviceIn = UtilMisc.toMap("partyId", partyId,
-                        "roleTypeId", "PLACING_CUSTOMER",
-                        "orderTypeId", "SALES_ORDER",
-                        "statusId", "ORDER_COMPLETED",
-                        "fromDate", fromDate,
-                        "thruDate", thruDate,
+                Timestamp thruDate = new Timestamp(thruDateCalendar.getTime().getTime());
+                Map serviceIn = UtilMisc.toMap("partyId", partyId,
+                        "roleTypeId", "PLACING_CUSTOMER",
+                        "orderTypeId", "SALES_ORDER",
+                        "statusId", "ORDER_COMPLETED",
+                        "fromDate", fromDate,
+                        "thruDate", thruDate,
                         "userLogin", userLogin);
                 try {
                     Map result = dispatcher.runSync("getOrderedSummaryInformation", serviceIn);
@@ -1114,8 +1114,8 @@
                     recurrence = new RecurrenceInfo(recurrenceInfo);
                 } catch (RecurrenceInfoException e) {
                     Debug.logError(e, module);
-                }  
-                
+                }
+
                 // check the current recurrence
                 if (recurrence != null) {
                     if (recurrence.isValidCurrent()) {
@@ -1152,7 +1152,7 @@
         // default to not meeting the condition
         return false;
     }
-    
+
     public static class ActionResultInfo {
         public boolean ranAction = false;
         public BigDecimal totalDiscountAmount = BigDecimal.ZERO;
@@ -1162,25 +1162,25 @@
     /** returns true if the cart was changed and rules need to be re-evaluted */
     protected static ActionResultInfo performAction(GenericValue productPromoAction, ShoppingCart cart, GenericDelegator delegator, LocalDispatcher dispatcher, Timestamp nowTimestamp) throws GenericEntityException, CartItemModifyException {
         ActionResultInfo actionResultInfo = new ActionResultInfo();
-        
+
         String productPromoActionEnumId = productPromoAction.getString("productPromoActionEnumId");
 
         if ("PROMO_GWP".equals(productPromoActionEnumId)) {
             String productStoreId = cart.getProductStoreId();
-            
+
             // the code was in there for this, so even though I don't think we want to restrict this, just adding this flag to make it easy to change; could make option dynamic, but now implied by the use limit
             boolean allowMultipleGwp = true;
-            
+
             Integer itemLoc = findPromoItem(productPromoAction, cart);
             if (!allowMultipleGwp && itemLoc != null) {
                 if (Debug.verboseOn()) Debug.logVerbose("Not adding promo item, already there; action: " + productPromoAction, module);
                 actionResultInfo.ranAction = false;
             } else {
                 BigDecimal quantity = productPromoAction.get("quantity") == null ? BigDecimal.ZERO : productPromoAction.getBigDecimal("quantity");
-                
+
                 List optionProductIds = FastList.newInstance();
                 String productId = productPromoAction.getString("productId");
-                
+
                 GenericValue product = null;
                 if (UtilValidate.isNotEmpty(productId)) {
                     // Debug.logInfo("======== Got GWP productId [" + productId + "]", module);
@@ -1191,7 +1191,7 @@
                         throw new CartItemModifyException(errMsg);
                     }
                     if ("Y".equals(product.getString("isVirtual"))) {
-                        List productAssocs = EntityUtil.filterByDate(product.getRelatedCache("MainProductAssoc",
+                        List productAssocs = EntityUtil.filterByDate(product.getRelatedCache("MainProductAssoc",
                                 UtilMisc.toMap("productAssocTypeId", "PRODUCT_VARIANT"), UtilMisc.toList("sequenceNum")));
                         Iterator productAssocIter = productAssocs.iterator();
                         while (productAssocIter.hasNext()) {
@@ -1221,13 +1221,13 @@
                         }
                     }
                 }
-                
+
                 // support multiple gift options if products are attached to the action, or if the productId on the action is a virtual product
                 Set productIds = ProductPromoWorker.getPromoRuleActionProductIds(productPromoAction, delegator, nowTimestamp);
                 if (productIds != null) {
                     optionProductIds.addAll(productIds);
                 }
-                
+
                 // make sure these optionProducts have inventory...
                 Iterator optionProductIdIter = optionProductIds.iterator();
                 while (optionProductIdIter.hasNext()) {
@@ -1247,7 +1247,7 @@
                         throw new CartItemModifyException(errMsg);
                     }
                 }
-                
+
                 // check to see if any desired productIds have been selected for this promo action
                 String alternateGwpProductId = cart.getDesiredAlternateGiftByAction(productPromoAction.getPrimaryKey());
                 if (UtilValidate.isNotEmpty(alternateGwpProductId)) {
@@ -1263,7 +1263,7 @@
                         Debug.logWarning(UtilProperties.getMessage(resource_error,"OrderAnAlternateGwpProductIdWasInPlaceButWasEitherNotValidOrIsNoLongerInStockForId", UtilMisc.toMap("alternateGwpProductId",alternateGwpProductId), cart.getLocale()), module);
                     }
                 }
-                
+
                 // if product is null, get one from the productIds set
                 if (product == null && optionProductIds.size() > 0) {
                     // get the first from an iterator and remove it since it will be the current one
@@ -1272,7 +1272,7 @@
                     optionProductIdTempIter.remove();
                     product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", productId));
                 }
-                    
+
                 if (product == null) {
                     // no product found to add as GWP, just return
                     return actionResultInfo;
@@ -1298,7 +1298,7 @@
                 BigDecimal discountAmount = quantity.multiply(gwpItem.getBasePrice()).negate();
 
                 doOrderItemPromoAction(productPromoAction, gwpItem, discountAmount, "amount", delegator);
-                
+
                 // set promo after create; note that to setQuantity we must clear this flag, setQuantity, then re-set the flag
                 gwpItem.setIsPromo(true);
                 if (Debug.verboseOn()) Debug.logVerbose("gwpItem adjustments: " + gwpItem.getAdjustments(), module);
@@ -1328,7 +1328,7 @@
                 // only include if it is in the productId Set for this check and if it is not a Promo (GWP) item
                 GenericValue product = cartItem.getProduct();
                 String parentProductId = cartItem.getParentProductId();
-                if (!cartItem.getIsPromo() &&
+                if (!cartItem.getIsPromo() &&
                         (productIds.contains(cartItem.getProductId()) || (parentProductId != null && productIds.contains(parentProductId))) &&
                         (product == null || !"N".equals(product.getString("includeInPromotions")))) {
                     // reduce quantity still needed to qualify for promo (quantityNeeded)
@@ -1363,7 +1363,7 @@
             BigDecimal quantityDesired = productPromoAction.get("quantity") == null ? BigDecimal.ONE : productPromoAction.getBigDecimal("quantity");
             BigDecimal startingQuantity = quantityDesired;
             BigDecimal discountAmountTotal = BigDecimal.ZERO;
-            
+
             Set productIds = ProductPromoWorker.getPromoRuleActionProductIds(productPromoAction, delegator, nowTimestamp);
 
             List lineOrderedByBasePriceList = cart.getLineListOrderedByBasePrice(false);
@@ -1373,7 +1373,7 @@
                 // only include if it is in the productId Set for this check and if it is not a Promo (GWP) item
                 String parentProductId = cartItem.getParentProductId();
                 GenericValue product = cartItem.getProduct();
-                if (!cartItem.getIsPromo() &&
+                if (!cartItem.getIsPromo() &&
                         (productIds.contains(cartItem.getProductId()) || (parentProductId != null && productIds.contains(parentProductId))) &&
                         (product == null || !"N".equals(product.getString("includeInPromotions")))) {
                     // reduce quantity still needed to qualify for promo (quantityNeeded)
@@ -1474,15 +1474,15 @@
                 if (UtilValidate.isEmpty(itemProductId)) {
                     continue;
                 }
-                
+
                 if (productIds.size() > 0 && !productIds.contains(itemProductId)) {
                     continue;
                 }
-                
+
                 if (cartItem.getSpecialPromoPrice() == null) {
                     continue;
                 }
-                
+
                 // get difference between basePrice and specialPromoPrice and adjust for that
                 BigDecimal difference = cartItem.getBasePrice().multiply(cartItem.getRentalAdjustment()).subtract(cartItem.getSpecialPromoPrice()).negate();
 
@@ -1510,7 +1510,7 @@
 
         return actionResultInfo;
     }
-    
+
     protected static List getCartItemsUsed(ShoppingCart cart, GenericValue productPromoAction) {
         List cartItemsUsed = FastList.newInstance();
         Iterator cartItemsIter = cart.iterator();
@@ -1523,7 +1523,7 @@
         }
         return cartItemsUsed;
     }
-    
+
     protected static BigDecimal getCartItemsUsedTotalAmount(ShoppingCart cart, GenericValue productPromoAction) {
         BigDecimal totalAmount = BigDecimal.ZERO;
         Iterator cartItemsIter = cart.iterator();
@@ -1536,7 +1536,7 @@
         }
         return totalAmount;
     }
-    
+
     protected static void distributeDiscountAmount(BigDecimal discountAmountTotal, BigDecimal totalAmount, List cartItemsUsed, GenericValue productPromoAction, GenericDelegator delegator) {
         BigDecimal discountAmount = discountAmountTotal;
         // distribute the discount evenly weighted according to price over the order items that the individual quantities came from; avoids a number of issues with tax/shipping calc, inclusion in the sub-total for other promotions, etc
@@ -1676,7 +1676,7 @@
     public static void makeProductPromoCondActionIdSets(String productPromoId, Set productIdsCond, Set productIdsAction, GenericDelegator delegator, Timestamp nowTimestamp) throws GenericEntityException {
         makeProductPromoCondActionIdSets(productPromoId, productIdsCond, productIdsAction, delegator, nowTimestamp, false);
     }
-    
+
     public static void makeProductPromoCondActionIdSets(String productPromoId, Set productIdsCond, Set productIdsAction, GenericDelegator delegator, Timestamp nowTimestamp, boolean filterOldProducts) throws GenericEntityException {
         if (nowTimestamp == null) {
             nowTimestamp = UtilDateTime.nowTimestamp();
@@ -1714,7 +1714,7 @@
 
         makeProductPromoIdSet(productIdsCond, productPromoCategoriesCond, productPromoProductsCond, delegator, nowTimestamp, filterOldProducts);
         makeProductPromoIdSet(productIdsAction, productPromoCategoriesAction, productPromoProductsAction, delegator, nowTimestamp, filterOldProducts);
-        
+
         // last of all filterOldProducts, done here to make sure no product gets looked up twice
         if (filterOldProducts) {
             Iterator productIdsCondIter = productIdsCond.iterator();
@@ -1733,7 +1733,7 @@
             }
         }
     }
-    
+
     protected static boolean isProductOld(String productId, GenericDelegator delegator, Timestamp nowTimestamp) throws GenericEntityException {
         GenericValue product = delegator.findByPrimaryKeyCache("Product", UtilMisc.toMap("productId", productId));
         if (product != null) {
@@ -1749,7 +1749,7 @@
         boolean include = !"PPPA_EXCLUDE".equals(productPromoApplEnumId);
         Set productCategoryIds = new HashSet();
         Map productCategoryGroupSetListMap = new HashMap();
-        
+
         Iterator productPromoCategoryIter = productPromoCategories.iterator();
         while (productPromoCategoryIter.hasNext()) {
             GenericValue productPromoCategory = (GenericValue) productPromoCategoryIter.next();
@@ -1760,7 +1760,7 @@
                 } else {
                     tempCatIdSet.add(productPromoCategory.getString("productCategoryId"));
                 }
-                
+
                 String andGroupId = productPromoCategory.getString("andGroupId");
                 if ("_NA_".equals(andGroupId)) {
                     productCategoryIds.addAll(tempCatIdSet);
@@ -1773,7 +1773,7 @@
                 }
             }
         }
-        
+
         // for the ones with andGroupIds, if there is only one category move it to the productCategoryIds Set
         // also remove all empty SetLists and Sets
         Iterator pcgslmeIter = productCategoryGroupSetListMap.entrySet().iterator();
@@ -1796,7 +1796,7 @@
 
         // now that the category Set and Map are setup, take care of the productCategoryIds Set first
         getAllProductIds(productCategoryIds, productIds, delegator, nowTimestamp, include);
-        
+
         // now handle the productCategoryGroupSetListMap
         // if a set has more than one category (because of an include sub-cats) then do an or
         // all lists will have more than category because of the pre-pass that was done, so and them together
@@ -1806,7 +1806,7 @@
             List catIdSetList = (List) entry.getValue();
             // get all productIds for this catIdSetList
             List productIdSetList = FastList.newInstance();
-            
+
             Iterator cidslIter = catIdSetList.iterator();
             while (cidslIter.hasNext()) {
                 // make a Set of productIds including all ids from all categories
@@ -1815,7 +1815,7 @@
                 getAllProductIds(catIdSet, groupProductIdSet, delegator, nowTimestamp, true);
                 productIdSetList.add(groupProductIdSet);
             }
-            
+
             // now go through all productId sets and only include IDs that are in all sets
             // by definition if each id must be in all categories, then it must be in the first, so go through the first and drop each one that is not in all others
             Set firstProductIdSet = (Set) productIdSetList.remove(0);
@@ -1824,12 +1824,12 @@
                 Set productIdSet = (Set) productIdSetIter.next();
                 firstProductIdSet.retainAll(productIdSet);
             }
-            
+
             /* the old way of doing it, not as efficient, recoded above using the retainAll operation, pretty handy
             Iterator firstProductIdIter = firstProductIdSet.iterator();
             while (firstProductIdIter.hasNext()) {
                 String curProductId = (String) firstProductIdIter.next();
-                
+
                 boolean allContainProductId = true;
                 Iterator productIdSetIter = productIdSetList.iterator();
                 while (productIdSetIter.hasNext()) {
@@ -1839,13 +1839,13 @@
                         break;
                     }
                 }
-                
+
                 if (!allContainProductId) {
                     firstProductIdIter.remove();
                 }
             }
              */
-            
+
             if (firstProductIdSet.size() >= 0) {
                 if (include) {
                     productIds.addAll(firstProductIdSet);
@@ -1855,7 +1855,7 @@
             }
         }
     }
-    
+
     protected static void getAllProductIds(Set productCategoryIdSet, Set productIdSet, GenericDelegator delegator, Timestamp nowTimestamp, boolean include) throws GenericEntityException {
         Iterator productCategoryIdIter = productCategoryIdSet.iterator();
         while (productCategoryIdIter.hasNext()) {
@@ -1891,7 +1891,7 @@
             }
         }
     }
-    
+
     protected static class UseLimitException extends Exception {
         public UseLimitException(String str) {
             super(str);

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductStoreCartAwareEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductStoreCartAwareEvents.java?rev=757091&r1=757090&r2=757091&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductStoreCartAwareEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductStoreCartAwareEvents.java Sat Mar 21 23:44:41 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -44,7 +44,7 @@
     public static String setSessionProductStore(HttpServletRequest request, HttpServletResponse response) {
         Map parameters = UtilHttp.getParameterMap(request);
         String productStoreId = (String) parameters.get("productStoreId");
-        
+
         try {
             ProductStoreCartAwareEvents.setSessionProductStore(productStoreId, request);
         } catch (Exception e) {
@@ -53,7 +53,7 @@
             request.setAttribute("_ERROR_MESSAGE_", errMsg);
             return "error";
         }
-        
+
         return "success";
     }
 
@@ -61,23 +61,23 @@
         if (productStoreId == null) {
             return;
         }
-        
+
         HttpSession session = request.getSession();
         String oldProductStoreId = (String) session.getAttribute("productStoreId");
-        
+
         if (productStoreId.equals(oldProductStoreId)) {
             // great, nothing to do, bye bye
             return;
         }
-        
+
         GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
-        
+
         // get the ProductStore record, make sure it's valid
         GenericValue productStore = ProductStoreWorker.getProductStore(productStoreId, delegator);
         if (productStore == null) {
             throw new IllegalArgumentException("Cannot set session ProductStore, passed productStoreId [" + productStoreId + "] is not valid/not found.");
         }
-        
+
         // make sure ProductStore change is allowed for the WebSite
         GenericValue webSite = WebSiteWorker.getWebSite(request);
         if (productStore == null) {
@@ -87,22 +87,22 @@
         if (!"Y".equals(allowProductStoreChange)) {
             throw new IllegalArgumentException("Cannot set session ProductStore, changing ProductStore not allowed for WebSite [" + webSite.getString("webSite") + "].");
         }
-        
+
         // set the productStoreId in the session (we know is different by this point)
         session.setAttribute("productStoreId", productStoreId);
-        
+
         // have set the new store, now need to clear out the current catalog so the default for the new store will be used
         session.removeAttribute("CURRENT_CATALOG_ID");
-        
+
         // if there is no locale or currencyUom in the session, set the defaults from the store, but don't do so through the CommonEvents methods setSessionLocale and setSessionCurrencyUom because we don't want these to be put on the UserLogin entity
         // note that this is different from the normal default setting process because these will now override the settings on the UserLogin; this is desired when changing stores and the user should be given a chance to change their personal settings after the store change
         UtilHttp.setCurrencyUomIfNone(session, productStore.getString("defaultCurrencyUomId"));
         UtilHttp.setLocaleIfNone(session, productStore.getString("defaultLocaleString"));
-        
-        // if a shoppingCart exists in the session and the productStoreId on it is different,
+
+        // if a shoppingCart exists in the session and the productStoreId on it is different,
         // - leave the old cart as-is (don't clear it, want to leave the auto-save list intact)
         // - but create a new cart (which will load from auto-save list if applicable) and put it in the session
-        
+
         ShoppingCart cart = ShoppingCartEvents.getCartObject(request);
         // this should always be different given the previous session productStoreId check, but just in case...
         if (!productStoreId.equals(cart.getProductStoreId())) {

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java?rev=757091&r1=757090&r2=757091&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java Sat Mar 21 23:44:41 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java?rev=757091&r1=757090&r2=757091&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java Sat Mar 21 23:44:41 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -123,7 +123,7 @@
         if (shipAddr == null) {
             return UtilMisc.toMap("shippingTotal", BigDecimal.ZERO);
         }
-        
+
         String contactMechId = shipAddr.getString("contactMechId");
         String partyId = null;
         GenericValue partyObject = orh.getPlacingParty();
@@ -170,7 +170,7 @@
         }
 
 //  ShipmentCostEstimate entity allows null value for geoIdTo field. So if geoIdTo is null we should be using orderFlatPrice for shipping cost.
-//  So now calcShipmentCostEstimate service requires shippingContactMechId only if geoIdTo field has not null value.        
+//  So now calcShipmentCostEstimate service requires shippingContactMechId only if geoIdTo field has not null value.
 //        if (shippingContactMechId == null) {
 //            errorMessageList.add("Please Select Your Shipping Address.");
 //            return ServiceUtil.returnError(errorMessageList);
@@ -214,7 +214,7 @@
         serviceFields.put("initialEstimateAmt", shippingTotal);
         serviceFields.put("shippableTotal", shippableTotal);
         serviceFields.put("shippableQuantity", shippableQuantity);
-        serviceFields.put("shippableWeight", shippableWeight);        
+        serviceFields.put("shippableWeight", shippableWeight);
         serviceFields.put("shippableItemInfo", itemInfo);
         serviceFields.put("productStoreId", productStoreId);
         serviceFields.put("carrierRoleTypeId", "CARRIER");
@@ -308,11 +308,11 @@
                     throw new GeneralException(e);
                 }
                 if (ServiceUtil.isError(serviceResp)) {
-                    String errMsg = "Error getting external shipment cost estimate: " + ServiceUtil.getErrorMessage(serviceResp);
+                    String errMsg = "Error getting external shipment cost estimate: " + ServiceUtil.getErrorMessage(serviceResp);
                     Debug.logError(errMsg, module);
                     throw new GeneralException(errMsg);
                 } else if (ServiceUtil.isFailure(serviceResp)) {
-                    String errMsg = "Failure getting external shipment cost estimate: " + ServiceUtil.getErrorMessage(serviceResp);
+                    String errMsg = "Failure getting external shipment cost estimate: " + ServiceUtil.getErrorMessage(serviceResp);
                     Debug.logError(errMsg, module);
                     // should not throw an Exception here, otherwise getShipGroupEstimate would return an error, causing all sorts of services like add or update order item to abort
                 } else {

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java?rev=757091&r1=757090&r2=757091&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java Sat Mar 21 23:44:41 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -61,7 +61,7 @@
  * Shopping cart events.
  */
 public class ShoppingListEvents {
-    
+
     public static final String module = ShoppingListEvents.class.getName();
     public static final String resource = "OrderUiLabels";
     public static final String resource_error = "OrderErrorUiLabels";
@@ -97,7 +97,7 @@
             errMsg = UtilProperties.getMessage(resource_error, "shoppinglistevents.select_items_to_add_to_list", cart.getLocale());
             throw new IllegalArgumentException(errMsg);
         }
-                
+
         if (UtilValidate.isEmpty(shoppingListId)) {
             // create a new shopping list
             Map newListResult = null;
@@ -118,9 +118,9 @@
             if (newListResult != null) {
                 shoppingListId = (String) newListResult.get("shoppingListId");
             }
-            
+
             // if no list was created throw an error
-            if (shoppingListId == null || shoppingListId.equals("")) {            
+            if (shoppingListId == null || shoppingListId.equals("")) {
                 errMsg = UtilProperties.getMessage(resource_error,"shoppinglistevents.shoppingListId_is_required_parameter", cart.getLocale());
                 throw new IllegalArgumentException(errMsg);
             }
@@ -132,15 +132,15 @@
                 throw new IllegalArgumentException("Could not clear current shopping list: " + e.toString());
             }
         }
-                
+
         for (int i = 0; i < items.length; i++) {
             Integer cartIdInt = null;
-            try {            
+            try {
                 cartIdInt = new Integer(items[i]);
             } catch (Exception e) {
                 Debug.logWarning(e, UtilProperties.getMessage(resource_error,"OrderIllegalCharacterInSelectedItemField", cart.getLocale()), module);
             }
-            if (cartIdInt != null) {            
+            if (cartIdInt != null) {
                 ShoppingCartItem item = cart.findCartItem(cartIdInt.intValue());
                 if (allowPromo || !item.getIsPromo()) {
                     Debug.logInfo("Adding cart item to shopping list [" + shoppingListId + "], allowPromo=" + allowPromo + ", item.getIsPromo()=" + item.getIsPromo() + ", item.getProductId()=" + item.getProductId() + ", item.getQuantity()=" + item.getQuantity(), module);
@@ -153,7 +153,7 @@
                   //    ctx.put("accommodationMapId", item.getAccommodationMapId());
                   //    ctx.put("accommodationSpotId", item.getAccommodationSpotId());
                         if (item.getConfigWrapper() != null) {
-                            ctx.put("configId", item.getConfigWrapper().getConfigId());                            
+                            ctx.put("configId", item.getConfigWrapper().getConfigId());
                         }
                         serviceResult = dispatcher.runSync("createShoppingListItem", ctx);
                     } catch (GenericServiceException e) {
@@ -169,11 +169,11 @@
                 }
             }
         }
-        
-        // return the shoppinglist id
+
+        // return the shoppinglist id
         return shoppingListId;
     }
-    
+
     public static String addListToCart(HttpServletRequest request, HttpServletResponse response) {
         GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator");
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
@@ -206,8 +206,8 @@
             errMsg = UtilProperties.getMessage(resource_error,"shoppinglistevents.choose_shopping_list", cart.getLocale());
             throw new IllegalArgumentException(errMsg);
         }
-        
-        // get the shopping list
+
+        // get the shopping list
         GenericValue shoppingList = null;
         List shoppingListItems = null;
         try {
@@ -238,7 +238,7 @@
             errMsg = UtilProperties.getMessage(resource_error,"shoppinglistevents.error_getting_shopping_list_and_items", cart.getLocale());
             throw new IllegalArgumentException(errMsg);
         }
-        
+
         // no items; not an error; just mention that nothing was added
         if (shoppingListItems == null || shoppingListItems.size() == 0) {
             errMsg = UtilProperties.getMessage(resource_error,"shoppinglistevents.no_items_added", cart.getLocale());
@@ -254,7 +254,7 @@
         Map shoppingListSurveyInfo = getItemSurveyInfos(shoppingListItems);
 
         // add the items
-        StringBuffer eventMessage = new StringBuffer();                      
+        StringBuffer eventMessage = new StringBuffer();
         Iterator i = shoppingListItems.iterator();
         while (i.hasNext()) {
             GenericValue shoppingListItem = (GenericValue) i.next();
@@ -264,7 +264,7 @@
             BigDecimal reservLength = shoppingListItem.getBigDecimal("reservLength");
             BigDecimal reservPersons = shoppingListItem.getBigDecimal("reservPersons");
       //    String accommodationMapId = shoppingListItem.getString("accommodationMapId");
-      //    String accommodationSpotId = shoppingListItem.getString("accommodationSpotId");            
+      //    String accommodationSpotId = shoppingListItem.getString("accommodationSpotId");
             String configId = shoppingListItem.getString("configId");
             try {
                 String listId = shoppingListItem.getString("shoppingListId");
@@ -281,17 +281,17 @@
                 if (shoppingListSurveyInfo.containsKey(listId + "." + itemId)) {
                     attributes.put("surveyResponses", shoppingListSurveyInfo.get(listId + "." + itemId));
                 }
-                
+
                 ProductConfigWrapper configWrapper = null;
                 if (UtilValidate.isNotEmpty(configId)) {
                     configWrapper = ProductConfigWorker.loadProductConfigWrapper(delegator, dispatcher, configId, productId, cart.getProductStoreId(), prodCatalogId, cart.getWebSiteId(), cart.getCurrency(), cart.getLocale(), cart.getAutoUserLogin());
                 }
                 // TODO: add code to check for survey response requirement
-                
+
                 // i cannot get the addOrDecrease function to accept a null reservStart field: i get a null pointer exception a null constant works....
                 if (reservStart == null) {
                        cart.addOrIncreaseItem(productId, null, quantity, null, null, null, null, null, null, attributes, prodCatalogId, configWrapper, null, null, null, dispatcher);
-                } else {                
+                } else {
                     cart.addOrIncreaseItem(productId, null, quantity, reservStart, reservLength, reservPersons, null, null, null, null, null, attributes, prodCatalogId, configWrapper, null, null, null, dispatcher);
                 }
                 Map messageMap = UtilMisc.toMap("productId", productId);
@@ -309,11 +309,11 @@
                 eventMessage.append(errMsg + "\n");
             }
         }
-        
+
         if (eventMessage.length() > 0) {
             return eventMessage.toString();
         }
-        
+
         // all done
         return ""; // no message to return; will simply reply as success
     }
@@ -325,14 +325,14 @@
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
         GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin");
         Locale locale = UtilHttp.getLocale(request);
-                
+
         BigDecimal quantity = null;
         try {
             quantity = new BigDecimal(quantityStr);
         } catch (Exception e) {
             // do nothing, just won't pass to service if it is null
         }
-        
+
         Map serviceInMap = new HashMap();
         serviceInMap.put("shoppingListId", request.getParameter("shoppingListId"));
         serviceInMap.put("shoppingListItemSeqId", request.getParameter("shoppingListItemSeqId"));
@@ -343,13 +343,13 @@
         try {
             result = dispatcher.runSync("updateShoppingListItem", serviceInMap);
         } catch (GenericServiceException e) {
-            String errMsg = UtilProperties.getMessage(resource_error,"shoppingListEvents.error_calling_update", locale) + ": "  + e.toString();            
-            request.setAttribute("_ERROR_MESSAGE_", errMsg);            
+            String errMsg = UtilProperties.getMessage(resource_error,"shoppingListEvents.error_calling_update", locale) + ": "  + e.toString();
+            request.setAttribute("_ERROR_MESSAGE_", errMsg);
             String errorMsg = "Error calling the updateShoppingListItem in handleShoppingListItemVariant: " + e.toString();
             Debug.logError(e, errorMsg, module);
             return "error";
         }
-        
+
         ServiceUtil.getMessages(request, result, "", "", "", "", "", "", "");
         if ("error".equals(result.get(ModelService.RESPONSE_MESSAGE))) {
             return "error";
@@ -357,7 +357,7 @@
             return "success";
         }
     }
-    
+
     /**
      * Finds or creates a specialized (auto-save) shopping list used to record shopping bag contents between user visits.
      */
@@ -417,16 +417,16 @@
     public static String saveCartToAutoSaveList(HttpServletRequest request, HttpServletResponse response) {
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
         ShoppingCart cart = ShoppingCartEvents.getCartObject(request);
-        
+
         try {
             fillAutoSaveList(cart, dispatcher);
         } catch (GeneralException e) {
             Debug.logError(e, "Error saving the cart to the auto-save list: " + e.toString(), module);
         }
-        
+
         return "success";
     }
-    
+
     /**
      * Restores the specialized (auto-save) shopping list back into the shopping cart
      */

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java?rev=757091&r1=757090&r2=757091&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java Sat Mar 21 23:44:41 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -126,7 +126,7 @@
         boolean beganTransaction = false;
         try {
             beganTransaction = TransactionUtil.begin();
-        
+
             List exprs = UtilMisc.toList(EntityCondition.makeCondition("shoppingListTypeId", EntityOperator.EQUALS, "SLT_AUTO_REODR"),
                     EntityCondition.makeCondition("isActive", EntityOperator.EQUALS, "Y"));
             EntityCondition cond = EntityCondition.makeCondition(exprs, EntityOperator.AND);
@@ -134,14 +134,14 @@
 
             EntityListIterator eli = null;
             eli = delegator.find("ShoppingList", cond, null, null, order, null);
-    
+
             if (eli != null) {
                 GenericValue shoppingList;
                 while (((shoppingList = (GenericValue) eli.next()) != null)) {
                     Timestamp lastOrder = shoppingList.getTimestamp("lastOrderedDate");
                     GenericValue recurrenceInfo = null;
                     recurrenceInfo = shoppingList.getRelatedOne("RecurrenceInfo");
-    
+
                     Timestamp startDateTime = recurrenceInfo.getTimestamp("startDateTime");
                     RecurrenceInfo recurrence = null;
                     if (recurrenceInfo != null) {
@@ -151,30 +151,30 @@
                             Debug.logError(e, module);
                         }
                     }
-    
+
                     // check the next recurrence
                     if (recurrence != null) {
                         long next = lastOrder == null ? recurrence.next(startDateTime.getTime()) : recurrence.next(lastOrder.getTime());
                         Timestamp now = UtilDateTime.nowTimestamp();
                         Timestamp nextOrder = UtilDateTime.getDayStart(UtilDateTime.getTimestamp(next));
-    
+
                         if (nextOrder.after(now)) {
                             continue;
                         }
                     } else {
                         continue;
                     }
-    
+
                     ShoppingCart listCart = makeShoppingListCart(dispatcher, shoppingList, locale);
                     CheckOutHelper helper = new CheckOutHelper(dispatcher, delegator, listCart);
-    
+
                     // store the order
                     Map createResp = helper.createOrder(userLogin);
                     if (createResp != null && ServiceUtil.isError(createResp)) {
                         Debug.logError("Cannot create order for shopping list - " + shoppingList, module);
                     } else {
                         String orderId = (String) createResp.get("orderId");
-    
+
                         // authorize the payments
                         Map payRes = null;
                         try {
@@ -182,29 +182,29 @@
                         } catch (GeneralException e) {
                             Debug.logError(e, module);
                         }
-    
+
                         if (payRes != null && ServiceUtil.isError(payRes)) {
                             Debug.logError("Payment processing problems with shopping list - " + shoppingList, module);
                         }
-    
+
                         shoppingList.set("lastOrderedDate", UtilDateTime.nowTimestamp());
                         shoppingList.store();
-    
+
                         // send notification
                         try {
                             dispatcher.runAsync("sendOrderPayRetryNotification", UtilMisc.toMap("orderId", orderId));
                         } catch (GenericServiceException e) {
                             Debug.logError(e, module);
                         }
-    
+
                         // increment the recurrence
                         recurrence.incrementCurrentCount();
                     }
                 }
-    
+
                 eli.close();
             }
-            
+
             return ServiceUtil.returnSuccess();
         } catch (GenericEntityException e) {
             try {
@@ -266,61 +266,61 @@
         boolean beganTransaction = false;
         try {
             beganTransaction = TransactionUtil.begin();
-        
+
             GenericValue orderHeader = null;
             orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId));
-    
+
             if (orderHeader == null) {
                 return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderUnableToLocateOrder", UtilMisc.toMap("orderId",orderId), locale));
             }
             String productStoreId = orderHeader.getString("productStoreId");
-    
+
             if (UtilValidate.isEmpty(shoppingListId)) {
                 // create a new shopping list
                 if (partyId == null) {
                     partyId = userLogin.getString("partyId");
                 }
-    
+
                 Map serviceCtx = UtilMisc.toMap("userLogin", userLogin, "partyId", partyId,
                         "productStoreId", productStoreId, "listName", "List Created From Order #" + orderId);
-    
+
                 if (UtilValidate.isNotEmpty(shoppingListTypeId)) {
                     serviceCtx.put("shoppingListTypeId", shoppingListTypeId);
                 }
-    
+
                 Map newListResult = null;
                 try {
-    
+
                     newListResult = dispatcher.runSync("createShoppingList", serviceCtx);
                 } catch (GenericServiceException e) {
                     Debug.logError(e, "Problems creating new ShoppingList", module);
                     return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderUnableToCreateNewShoppingList",locale));
                 }
-    
+
                 // check for errors
                 if (ServiceUtil.isError(newListResult)) {
                     return ServiceUtil.returnError(ServiceUtil.getErrorMessage(newListResult));
                 }
-    
+
                 // get the new list id
                 if (newListResult != null) {
                     shoppingListId = (String) newListResult.get("shoppingListId");
                 }
             }
-    
+
             GenericValue shoppingList = null;
             shoppingList = delegator.findByPrimaryKey("ShoppingList", UtilMisc.toMap("shoppingListId", shoppingListId));
-    
+
             if (shoppingList == null) {
                 return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderNoShoppingListAvailable",locale));
             }
             shoppingListTypeId = shoppingList.getString("shoppingListTypeId");
-    
+
             OrderReadHelper orh = new OrderReadHelper(orderHeader);
             if (orh == null) {
                 return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderUnableToLoadOrderReadHelper", UtilMisc.toMap("orderId",orderId), locale));
             }
-    
+
             List orderItems = orh.getOrderItems();
             Iterator i = orderItems.iterator();
             String productId = null;
@@ -353,11 +353,11 @@
                     }
                 }
             }
-    
+
             if ("SLT_AUTO_REODR".equals(shoppingListTypeId)) {
                 GenericValue paymentPref = EntityUtil.getFirst(orh.getPaymentPreferences());
                 GenericValue shipGroup = EntityUtil.getFirst(orh.getOrderItemShipGroups());
-    
+
                 Map slCtx = new HashMap();
                 slCtx.put("shipmentMethodTypeId", shipGroup.get("shipmentMethodTypeId"));
                 slCtx.put("carrierRoleTypeId", shipGroup.get("carrierRoleTypeId"));
@@ -372,23 +372,23 @@
                 slCtx.put("isActive", "Y");
                 slCtx.put("shoppingListId", shoppingListId);
                 slCtx.put("userLogin", userLogin);
-    
+
                 Map slUpResp = null;
                 try {
                     slUpResp = dispatcher.runSync("updateShoppingList", slCtx);
                 } catch (GenericServiceException e) {
                     Debug.logError(e, module);
                 }
-    
+
                 if (slUpResp == null || ServiceUtil.isError(slUpResp)) {
                     return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderUnableToUpdateShoppingListInformation",UtilMisc.toMap("shoppingListId",shoppingListId), locale));
                 }
             }
-    
+
             Map result = ServiceUtil.returnSuccess();
             result.put("shoppingListId", shoppingListId);
             return result;
-            
+
         } catch (GenericEntityException e) {
             try {
                 // only rollback the transaction if we started one...
@@ -421,7 +421,7 @@
 
     /**
      * Add a shoppinglist to an existing shoppingcart
-     *
+     *
      * @param shoppingCart
      * @param dispatcher
      * @param shoppingList
@@ -458,14 +458,14 @@
                     listCart.setAutoOrderShoppingListId(shoppingList.getString("shoppingListId"));
                 } else {
                     if (!listCart.getPartyId().equals(shoppingList.getString("partyId"))) {
-                        Debug.logError("CANNOT add shoppingList: " + shoppingList.getString("shoppingListId")
+                        Debug.logError("CANNOT add shoppingList: " + shoppingList.getString("shoppingListId")
                                 + " of partyId: " + shoppingList.getString("partyId")
-                                + " to a shoppingcart with a different orderPartyId: "
+                                + " to a shoppingcart with a different orderPartyId: "
                                 + listCart.getPartyId(), module);
                         return listCart;
                     }
                 }
-                
+
 
                 Iterator i = items.iterator();
                 ProductConfigWrapper configWrapper = null;
@@ -502,7 +502,7 @@
                         String itemId = shoppingListItem.getString("shoppingListItemSeqId");
                         Map attributes = UtilMisc.toMap("shoppingListId", listId, "shoppingListItemSeqId", itemId);
 
-                        try {
+                        try {
                             listCart.addOrIncreaseItem(productId, null, quantity, reservStart, reservLength, reservPersons, null, null, null, null, null, attributes, null, configWrapper, null, null, null, dispatcher);
                         } catch (CartItemModifyException e) {
                             Debug.logError(e, "Unable to add product to List Cart - " + productId, module);
@@ -546,7 +546,7 @@
     }
 
     /**
-     *
+     *
      * Given an orderId, this service will look through all its OrderItems and for each shoppingListItemId
      * and shoppingListItemSeqId, update the quantity purchased in the ShoppingListItem entity.  Used for
      * tracking how many of shopping list items are purchased.  This service is mounted as a seca on storeOrder.

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskEvents.java?rev=757091&r1=757090&r2=757091&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskEvents.java Sat Mar 21 23:44:41 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -44,15 +44,15 @@
  * Order Processing Task Events
  */
 public class TaskEvents {
-    
+
     public static final String module = TaskEvents.class.getName();
     public static final String resource_error = "OrderErrorUiLabels";
-    
+
     /** Complete assignment event */
     public static String completeAssignment(HttpServletRequest request, HttpServletResponse response) {
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
         GenericValue userLogin = (GenericValue) request.getSession().getAttribute("userLogin");
-        
+
         Map parameterMap = UtilHttp.getParameterMap(request);
         String workEffortId = (String) parameterMap.remove("workEffortId");
         String partyId = (String) parameterMap.remove("partyId");
@@ -60,17 +60,17 @@
         String fromDateStr = (String) parameterMap.remove("fromDate");
         java.sql.Timestamp fromDate = null;
         Locale locale = UtilHttp.getLocale(request);
-        
-        try {      
+
+        try {
             fromDate = (java.sql.Timestamp) ObjectType.simpleTypeConvert(fromDateStr, "java.sql.Timestamp", null, null);
         } catch (GeneralException e) {
             request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderInvalidDateFormatForFromDate", locale));
-            return "error";        
+            return "error";
         }
-        
+
         Map result = null;
         try {
-            Map context = UtilMisc.toMap("workEffortId", workEffortId, "partyId", partyId, "roleTypeId", roleTypeId,
+            Map context = UtilMisc.toMap("workEffortId", workEffortId, "partyId", partyId, "roleTypeId", roleTypeId,
                     "fromDate", fromDate, "result", parameterMap, "userLogin", userLogin);
             result = dispatcher.runSync("wfCompleteAssignment", context);
             if (result.containsKey(ModelService.RESPOND_ERROR)) {
@@ -82,49 +82,49 @@
             return "error";
         }
 
-        return "success";              
-    }    
-    
+        return "success";
+    }
+
     /** Accept role assignment event */
-    public static String acceptRoleAssignment(HttpServletRequest request, HttpServletResponse response) {
+    public static String acceptRoleAssignment(HttpServletRequest request, HttpServletResponse response) {
         ServletContext ctx = (ServletContext) request.getAttribute("servletContext");
         RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_");
         Locale locale = UtilHttp.getLocale(request);
-        
+
         if (addToOrderRole(request)) {
-            try {                
+            try {
                 EventHandler eh = rh.getEventFactory().getEventHandler("service");
-                eh.invoke(new Event("service", "", "wfAcceptRoleAssignment", true), null, request, response);
+                eh.invoke(new Event("service", "", "wfAcceptRoleAssignment", true), null, request, response);
             } catch (EventHandlerException e) {
                 Debug.logError(e, "Invocation error", module);
                 request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderFailedToInvokeTheWfAcceptRoleAssignmentService", locale));
                 return "error";
-            }
-            return "success";                        
-        }                    
+            }
+            return "success";
+        }
         return "error";
     }
-    
+
     /** Delegate and accept assignment event */
-    public static String delegateAndAcceptAssignment(HttpServletRequest request, HttpServletResponse response) {        
+    public static String delegateAndAcceptAssignment(HttpServletRequest request, HttpServletResponse response) {
         ServletContext ctx = (ServletContext) request.getAttribute("servletContext");
         RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_");
         Locale locale = UtilHttp.getLocale(request);
-        
+
         if (addToOrderRole(request)) {
             try {
                 EventHandler eh = rh.getEventFactory().getEventHandler("service");
-                eh.invoke(new Event("service", "", "wfAcceptRoleAssignment", true), null, request, response);
+                eh.invoke(new Event("service", "", "wfAcceptRoleAssignment", true), null, request, response);
             } catch (EventHandlerException e) {
                 Debug.logError(e, "Invocation error", module);
                 request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderFailedToInvokeTheWfDelegateAndAcceptAssignmentService", locale));
                 return "error";
-            }    
-            return "success";                      
-        }            
+            }
+            return "success";
+        }
         return "error";
     }
-        
+
     private static boolean addToOrderRole(HttpServletRequest request) {
         LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
         String partyId = request.getParameter("partyId");
@@ -133,8 +133,8 @@
         Map context = UtilMisc.toMap("orderId", orderId, "partyId", partyId, "roleTypeId", roleTypeId);
         Map result = null;
         try {
-            result = dispatcher.runSync("addOrderRole", context);  
-            Debug.logInfo("Added user to order role " + result, module);          
+            result = dispatcher.runSync("addOrderRole", context);
+            Debug.logInfo("Added user to order role " + result, module);
         } catch (GenericServiceException gse) {
             request.setAttribute("_ERROR_MESSAGE_", gse.getMessage());
             return false;

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskWorker.java?rev=757091&r1=757090&r2=757091&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskWorker.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskWorker.java Sat Mar 21 23:44:41 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -29,9 +29,9 @@
  * Order Processing Task Worker
  */
 public class TaskWorker {
-    
+
     public static final String module = TaskWorker.class.getName();
-    
+
     public static String getCustomerName(GenericValue orderTaskList) {
         String lastName = orderTaskList.getString("customerLastName");
         String firstName = orderTaskList.getString("customerFirstName");
@@ -47,20 +47,20 @@
         } else {
             return "";
         }
-    }
-    
+    }
+
     static Map statusMapping = UtilMisc.toMap("WF_NOT_STARTED", "Waiting", "WF_RUNNING", "Active", "WF_COMPLETE", "Complete", "WF_SUSPENDED", "Hold");
-    
+
     public static String getPrettyStatus(GenericValue orderTaskList) {
-        String statusId = orderTaskList.getString("currentStatusId");        
+        String statusId = orderTaskList.getString("currentStatusId");
         String prettyStatus = (String) statusMapping.get(statusId);
         if (prettyStatus == null)
             prettyStatus = "?";
         return prettyStatus;
     }
-        
-    
-    public static String getRoleDescription(GenericValue orderTaskList) {        
+
+
+    public static String getRoleDescription(GenericValue orderTaskList) {
         GenericValue role = null;
         try {
             Map pkFields = UtilMisc.toMap("roleTypeId", orderTaskList.getString("roleTypeId"));
@@ -70,6 +70,6 @@
             return orderTaskList.getString("roleTypeId");
         }
         return role.getString("description");
-    }  
-    
+    }
+
 }

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java?rev=757091&r1=757090&r2=757091&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java Sat Mar 21 23:44:41 2009
@@ -6,9 +6,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- *
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -48,11 +48,11 @@
 public class OrderTestServices {
 
     public static final String module = OrderTestServices.class.getName();
-    
+
     public static Map createTestSalesOrders(DispatchContext dctx, Map context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         Integer numberOfOrders = (Integer) context.get("numberOfOrders");
-        
+
         int numberOfOrdersInt = numberOfOrders.intValue();
         for (int i = 1; i <= numberOfOrdersInt; i++) {
             try {
@@ -65,13 +65,13 @@
         }
         return ServiceUtil.returnSuccess();
     }
-    
+
     public static Map createTestSalesOrderSingle(DispatchContext dctx, Map context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericDelegator delegator = dctx.getDelegator();
         Locale locale = (Locale) context.get("locale");
         GenericValue userLogin = (GenericValue) context.get("userLogin");
-        
+
         String productCategoryId = (String) context.get("productCategoryId");
         String productStoreId = (String) context.get("productStoreId");
         String currencyUomId = (String) context.get("currencyUomId");
@@ -82,9 +82,9 @@
         if (UtilValidate.isEmpty(salesChannel)) {
             salesChannel = "WEB_SALES_CHANNEL";
         }
-        
+
         int numberOfProductsPerOrderInt = numberOfProductsPerOrder.intValue();
-        
+
         List productsList = FastList.newInstance();
         try {
             Map result = dispatcher.runSync("getProductCategoryMembers", UtilMisc.toMap("categoryId", productCategoryId));
@@ -108,7 +108,7 @@
         }
 
         Random r = new Random();
-        
+
         ShoppingCart cart = new ShoppingCart(delegator, productStoreId, locale, currencyUomId);
         cart.setOrderType("SALES_ORDER");
         cart.setChannelType(salesChannel);
@@ -128,7 +128,7 @@
             int k = r.nextInt(productsList.size());
             try {
                 cart.addOrIncreaseItem((String) productsList.get(k), null, BigDecimal.ONE, null, null, null,
-                                       null, null, null, null,
+                                       null, null, null, null,
                                        null /*catalogId*/, null, null/*itemType*/, null/*itemGroupNumber*/, null, dispatcher);
             } catch (Exception exc) {
                 Debug.logWarning("Error adding product with id " + (String) productsList.get(k) + " to the cart: " + exc.getMessage(), module);
@@ -145,7 +145,7 @@
             boolean approved = OrderChangeHelper.approveOrder(dispatcher, userLogin, orderId);
             Debug.logInfo("Test order with id: " + orderId + " has been approved: " + approved, module);
         }
-        
+
         return ServiceUtil.returnSuccess();
     }
 }