svn commit: r660691 - in /ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart: ShoppingCartEvents.java ShoppingCartItem.java

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

svn commit: r660691 - in /ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart: ShoppingCartEvents.java ShoppingCartItem.java

jleroux@apache.org
Author: jleroux
Date: Tue May 27 13:36:25 2008
New Revision: 660691

URL: http://svn.apache.org/viewvc?rev=660691&view=rev
Log:
Merged by hand from trunk revision: 660680

Modified:
    ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
    ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java

Modified: ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=660691&r1=660690&r2=660691&view=diff
==============================================================================
--- ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original)
+++ ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Tue May 27 13:36:25 2008
@@ -262,7 +262,7 @@
             }
 
             if (reservStart != null && reservEnd != null) {
-             reservLength = new Double(UtilDateTime.getInterval(reservStart,reservEnd)/86400000);
+                reservLength = new Double(UtilDateTime.getInterval(reservStart,reservEnd)/86400000);
             }
 
 
@@ -731,11 +731,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";
         }
 
@@ -743,13 +743,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";
         }
 
@@ -785,7 +785,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";
         }
 
@@ -816,7 +816,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";
         }
 
@@ -1073,6 +1073,7 @@
         try {
             Map outMap = dispatcher.runSync("loadCartFromOrder",
                                             UtilMisc.toMap("orderId", quoteId,
+                                                           "skipProductChecks", Boolean.TRUE, // the products have already been checked in the order, no need to check their validity again
                                                            "userLogin", userLogin));
             cart = (ShoppingCart) outMap.get("shoppingCart");
         } catch (GenericServiceException exc) {

Modified: ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java?rev=660691&r1=660690&r2=660691&view=diff
==============================================================================
--- ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java (original)
+++ ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java Tue May 27 13:36:25 2008
@@ -424,7 +424,20 @@
                 }
             }
              */
+            
+            // check to see if the product is fully configured
+            if ("AGGREGATED".equals(product.getString("productTypeId"))) {
+                if (configWrapper == null || !configWrapper.isCompleted()) {                
+                    Map messageMap = UtilMisc.toMap("productName", product.getString("productName"),
+                                                    "productId", product.getString("productId"));
+                    String excMsg = UtilProperties.getMessage(resource, "item.cannot_add_product_not_configured_correctly",
+                                                  messageMap , cart.getLocale() );
+                    Debug.logWarning(excMsg, module);
+                    throw new CartItemModifyException(excMsg);
+                }
+            }                        
         }
+        
         // check to see if the product is a rental item
         if ("ASSET_USAGE".equals(product.getString("productTypeId"))) {
             if (reservStart == null)    {
@@ -479,18 +492,6 @@
             }
         }
         
-        // check to see if the product is fully configured
-        if ("AGGREGATED".equals(product.getString("productTypeId"))) {
-            if (configWrapper == null || !configWrapper.isCompleted()) {                
-                Map messageMap = UtilMisc.toMap("productName", product.getString("productName"),
-                                                "productId", product.getString("productId"));
-                String excMsg = UtilProperties.getMessage(resource, "item.cannot_add_product_not_configured_correctly",
-                                              messageMap , cart.getLocale() );
-                Debug.logWarning(excMsg, module);
-                throw new CartItemModifyException(excMsg);
-            }
-        }
-        
         // set the ship before and after dates (defaults to cart ship before/after dates)
         newItem.setShipBeforeDate(shipBeforeDate != null ? shipBeforeDate : cart.getDefaultShipBeforeDate());
         newItem.setShipAfterDate(shipAfterDate != null ? shipAfterDate : cart.getDefaultShipAfterDate());