svn commit: r729621 - in /ofbiz/trunk/applications/order/src/org/ofbiz/order: shoppingcart/ShoppingCartEvents.java shoppingcart/ShoppingCartHelper.java shoppinglist/ShoppingListEvents.java shoppinglist/ShoppingListServices.java

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

svn commit: r729621 - in /ofbiz/trunk/applications/order/src/org/ofbiz/order: shoppingcart/ShoppingCartEvents.java shoppingcart/ShoppingCartHelper.java shoppinglist/ShoppingListEvents.java shoppinglist/ShoppingListServices.java

jleroux@apache.org
Author: jleroux
Date: Sat Dec 27 02:25:00 2008
New Revision: 729621

URL: http://svn.apache.org/viewvc?rev=729621&view=rev
Log:
Replace some tabs by 4 spaces (from https://issues.apache.org/jira/browse/OFBIZ-2105?focusedCommentId=12659250#action_12659250)
No functional changes only replacements

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=729621&r1=729620&r2=729621&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Sat Dec 27 02:25:00 2008
@@ -156,12 +156,12 @@
         if (paramMap.containsKey("ADD_PRODUCT_ID")) {
             productId = (String) paramMap.remove("ADD_PRODUCT_ID");
         } else if (paramMap.containsKey("add_product_id")) {
-         Object object = paramMap.remove("add_product_id");
-         try{
-         productId = (String) object;
-         }catch(ClassCastException e){
-         productId = (String)((List)object).get(0);
-         }
+            Object object = paramMap.remove("add_product_id");
+            try{
+                productId = (String) object;
+            }catch(ClassCastException e){
+                productId = (String)((List)object).get(0);
+            }
         }
         if (paramMap.containsKey("PRODUCT_ID")) {
             parentProductId = (String) paramMap.remove("PRODUCT_ID");
@@ -241,23 +241,23 @@
         //Check for virtual products
         if (ProductWorker.isVirtual(delegator, productId)) {
 
- if ("VV_FEATURETREE".equals(ProductWorker.getProductvirtualVariantMethod(delegator, productId))) {
- // get the selected features.
- List <String> selectedFeatures = new LinkedList<String>();
-     java.util.Enumeration paramNames = request.getParameterNames();
-     while(paramNames.hasMoreElements()) {
-     String paramName = (String)paramNames.nextElement();
-     if (paramName.startsWith("FT")) {
-     selectedFeatures.add(request.getParameterValues(paramName)[0]);
-     }
-     }
-    
-     // check if features are selected
-     if (UtilValidate.isEmpty(selectedFeatures)) {
- request.setAttribute("product_id", productId);
- request.setAttribute("_EVENT_MESSAGE_",UtilProperties.getMessage(resource,"cart.addToCart.chooseVariationBeforeAddingToCart",locale));
- return "product";
-     }
+            if ("VV_FEATURETREE".equals(ProductWorker.getProductvirtualVariantMethod(delegator, productId))) {
+                // get the selected features.
+                List <String> selectedFeatures = new LinkedList<String>();
+                java.util.Enumeration paramNames = request.getParameterNames();
+                while(paramNames.hasMoreElements()) {
+                    String paramName = (String)paramNames.nextElement();
+                    if (paramName.startsWith("FT")) {
+                        selectedFeatures.add(request.getParameterValues(paramName)[0]);
+                    }
+                }
+                
+                // check if features are selected
+                if (UtilValidate.isEmpty(selectedFeatures)) {
+                    request.setAttribute("product_id", productId);
+                    request.setAttribute("_EVENT_MESSAGE_",UtilProperties.getMessage(resource,"cart.addToCart.chooseVariationBeforeAddingToCart",locale));
+                    return "product";
+                }
 
                 String variantProductId = ProductWorker.getVariantFromFeatureTree(productId, selectedFeatures, delegator);
                 if (UtilValidate.isNotEmpty(variantProductId)) {
@@ -268,12 +268,12 @@
                     return "product";
                 }
 
- } else {
- request.setAttribute("product_id", productId);
- request.setAttribute("_EVENT_MESSAGE_",UtilProperties.getMessage(resource,"cart.addToCart.chooseVariationBeforeAddingToCart",locale));
- return "product";
- }
- }
+            } else {
+                request.setAttribute("product_id", productId);
+                request.setAttribute("_EVENT_MESSAGE_",UtilProperties.getMessage(resource,"cart.addToCart.chooseVariationBeforeAddingToCart",locale));
+                return "product";
+            }
+        }
         
         // get the override price
         if (paramMap.containsKey("PRICE")) {
@@ -323,7 +323,7 @@
             }
 
             if (reservStart != null && reservEnd != null) {
-             reservLength = new Double(UtilDateTime.getInterval(reservStart,reservEnd)/86400000);
+                reservLength = new Double(UtilDateTime.getInterval(reservStart,reservEnd)/86400000);
             }
 
             if (reservStart != null && paramMap.containsKey("reservLength")) {
@@ -362,8 +362,8 @@
 
             //check accommodation for reservations
             if((paramMap.containsKey("accommodationMapId")) && (paramMap.containsKey("accommodationSpotId"))){
-             accommodationMapId = (String) paramMap.remove("accommodationMapId");
-             accommodationSpotId = (String) paramMap.remove("accommodationSpotId");
+                accommodationMapId = (String) paramMap.remove("accommodationMapId");
+                accommodationSpotId = (String) paramMap.remove("accommodationSpotId");
             }
         }
 
@@ -549,9 +549,9 @@
             return "error";
         } else {
             if (cart.viewCartOnAdd()) {
-             return "viewcart";
+                return "viewcart";
             } else {
-             return "success";
+                return "success";
             }
         }
     }
@@ -940,11 +940,11 @@
         Locale locale = UtilHttp.getLocale(request);
 
         if (UtilValidate.isEmpty(alternateGwpProductId)) {
-         request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderCouldNotSelectAlternateGiftNoAlternateGwpProductIdPassed", locale));
+            request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderCouldNotSelectAlternateGiftNoAlternateGwpProductIdPassed", locale));
             return "error";
         }
         if (UtilValidate.isEmpty(alternateGwpLineStr)) {
-         request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderCouldNotSelectAlternateGiftNoAlternateGwpLinePassed", locale));
+            request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderCouldNotSelectAlternateGiftNoAlternateGwpLinePassed", locale));
             return "error";
         }
 
@@ -952,13 +952,13 @@
         try {
             alternateGwpLine = Integer.parseInt(alternateGwpLineStr);
         } catch (Exception e) {
-         request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderCouldNotSelectAlternateGiftAlternateGwpLineIsNotAValidNumber", locale));
+            request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderCouldNotSelectAlternateGiftAlternateGwpLineIsNotAValidNumber", locale));
             return "error";
         }
 
         ShoppingCartItem cartLine = cart.findCartItem(alternateGwpLine);
         if (cartLine == null) {
-         request.setAttribute("_ERROR_MESSAGE_", "Could not select alternate gift, no cart line item found for #" + alternateGwpLine + ".");
+            request.setAttribute("_ERROR_MESSAGE_", "Could not select alternate gift, no cart line item found for #" + alternateGwpLine + ".");
             return "error";
         }
 
@@ -994,7 +994,7 @@
         int i;
 
         if (UtilValidate.isEmpty(partyId) || roleTypeId.length < 1) {
-         request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderPartyIdAndOrRoleTypeIdNotDefined", locale));
+            request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderPartyIdAndOrRoleTypeIdNotDefined", locale));
             return "error";
         }
 
@@ -1025,7 +1025,7 @@
         int i;
 
         if (UtilValidate.isEmpty(partyId) || roleTypeId.length < 1) {
-         request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderPartyIdAndOrRoleTypeIdNotDefined", locale));
+            request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resource_error,"OrderPartyIdAndOrRoleTypeIdNotDefined", locale));
             return "error";
         }
 

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java?rev=729621&r1=729620&r2=729621&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java Sat Dec 27 02:25:00 2008
@@ -678,16 +678,16 @@
                     } else if (parameterName.toUpperCase().startsWith("DESCRIPTION")) {
                         itemDescription = quantString;  // the quantString is actually the description if the field name starts with DESCRIPTION
                     } else if (parameterName.startsWith("reservStart")) {
-                     if (quantString.length() ==0){
-                     // should have format: yyyy-mm-dd hh:mm:ss.fffffffff                    
-                     quantString += " 00:00:00.000000000";
-                     }
-                     if (item != null) {                        
-                     Timestamp reservStart = Timestamp.valueOf(quantString);
-                     item.setReservStart(reservStart);
-                     }
+                        if (quantString.length() ==0){
+                            // should have format: yyyy-mm-dd hh:mm:ss.fffffffff                    
+                            quantString += " 00:00:00.000000000";
+                        }
+                        if (item != null) {                        
+                            Timestamp reservStart = Timestamp.valueOf(quantString);
+                            item.setReservStart(reservStart);
+                        }
                     } else if (parameterName.startsWith("reservLength")) {
-                     if (item != null) {
+                        if (item != null) {
                             double reservLength = nf.parse(quantString).doubleValue();
                             item.setReservLength(reservLength);
                         }

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=729621&r1=729620&r2=729621&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 Dec 27 02:25:00 2008
@@ -138,7 +138,7 @@
             try {            
                 cartIdInt = new Integer(items[i]);
             } catch (Exception e) {
-             Debug.logWarning(e, UtilProperties.getMessage(resource_error,"OrderIllegalCharacterInSelectedItemField", cart.getLocale()), module);
+                Debug.logWarning(e, UtilProperties.getMessage(resource_error,"OrderIllegalCharacterInSelectedItemField", cart.getLocale()), module);
             }
             if (cartIdInt != null) {            
                 ShoppingCartItem item = cart.findCartItem(cartIdInt.intValue());
@@ -298,12 +298,12 @@
                 errMsg = UtilProperties.getMessage(resource,"shoppinglistevents.added_product_to_cart", messageMap, cart.getLocale());
                 eventMessage.append(errMsg + "\n");
             } catch (CartItemModifyException e) {
-             Debug.logWarning(e, UtilProperties.getMessage(resource_error,"OrderProblemsAddingItemFromListToCart", cart.getLocale()));
+                Debug.logWarning(e, UtilProperties.getMessage(resource_error,"OrderProblemsAddingItemFromListToCart", cart.getLocale()));
                 Map messageMap = UtilMisc.toMap("productId", productId);
                 errMsg = UtilProperties.getMessage(resource,"shoppinglistevents.problem_adding_product_to_cart", messageMap, cart.getLocale());
                 eventMessage.append(errMsg + "\n");
             } catch (ItemNotFoundException e) {
-             Debug.logWarning(e, UtilProperties.getMessage(resource_error,"OrderProductNotFound", cart.getLocale()));
+                Debug.logWarning(e, UtilProperties.getMessage(resource_error,"OrderProductNotFound", cart.getLocale()));
                 Map messageMap = UtilMisc.toMap("productId", productId);
                 errMsg = UtilProperties.getMessage(resource,"shoppinglistevents.problem_adding_product_to_cart", messageMap, cart.getLocale());
                 eventMessage.append(errMsg + "\n");
@@ -343,7 +343,7 @@
         try {
             result = dispatcher.runSync("updateShoppingListItem", serviceInMap);
         } catch (GenericServiceException e) {
-         String errMsg = UtilProperties.getMessage(ShoppingListEvents.err_resource,"shoppingListEvents.error_calling_update", locale) + ": "  + e.toString();            
+            String errMsg = UtilProperties.getMessage(ShoppingListEvents.err_resource,"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);

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=729621&r1=729620&r2=729621&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 Dec 27 02:25:00 2008
@@ -416,7 +416,7 @@
      * @return
      */
     public static ShoppingCart makeShoppingListCart(LocalDispatcher dispatcher, GenericValue shoppingList, Locale locale) {
-     return makeShoppingListCart(null, dispatcher, shoppingList, locale); }
+        return makeShoppingListCart(null, dispatcher, shoppingList, locale); }
 
     /**
      * Add a shoppinglist to an existing shoppingcart
@@ -451,20 +451,20 @@
             }
 
             if (UtilValidate.isNotEmpty(items)) {
-             if (listCart == null) {
-             listCart = new ShoppingCart(delegator, productStoreId, locale, currencyUom);
-             listCart.setOrderPartyId(shoppingList.getString("partyId"));
-             listCart.setAutoOrderShoppingListId(shoppingList.getString("shoppingListId"));
-             } else {
-             if (!listCart.getPartyId().equals(shoppingList.getString("partyId"))){
-             Debug.logError("CANNOT add shoppingList: " + shoppingList.getString("shoppingListId")
-             + " of partyId: " + shoppingList.getString("partyId")
-             + " to a shoppingcart with a different orderPartyId: "
-             + listCart.getPartyId(), module);
-                 return listCart;
-             }
-             }
-            
+                if (listCart == null) {
+                    listCart = new ShoppingCart(delegator, productStoreId, locale, currencyUom);
+                    listCart.setOrderPartyId(shoppingList.getString("partyId"));
+                    listCart.setAutoOrderShoppingListId(shoppingList.getString("shoppingListId"));
+                } else {
+                    if (!listCart.getPartyId().equals(shoppingList.getString("partyId"))){
+                        Debug.logError("CANNOT add shoppingList: " + shoppingList.getString("shoppingListId")
+                                + " of partyId: " + shoppingList.getString("partyId")
+                                + " to a shoppingcart with a different orderPartyId: "
+                                + listCart.getPartyId(), module);
+                        return listCart;
+                    }
+                }
+                
 
                 Iterator i = items.iterator();
                 ProductConfigWrapper configWrapper = null;