Author: jleroux Date: Thu Sep 8 11:26:41 2011 New Revision: 1166635 URL: http://svn.apache.org/viewvc?rev=1166635&view=rev Log: "Applied fix from trunk for revision: 1166591" (conflict handled by hand) ------------------------------------------------------------------------ r1166591 | jleroux | 2011-09-08 11:54:48 +0200 (jeu., 08 sept. 2011) | 3 lines
A slightly modified patch from Dimitri Unruh "cartNotEmpty returns wrong results" https://issues.apache.org/jira/browse/OFBIZ-4397 The cartNotEmpty method return "success" if I got a cart object in my session, but with no items. ------------------------------------------------------------------------ Modified: ofbiz/branches/release09.04/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Modified: ofbiz/branches/release09.04/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java?rev=1166635&r1=1166634&r2=1166635&view=diff ============================================================================== --- ofbiz/branches/release09.04/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java (original) +++ ofbiz/branches/release09.04/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Thu Sep 8 11:26:41 2011 @@ -57,14 +57,12 @@ public class CheckOutEvents { public static final String resource_error = "OrderErrorUiLabels"; public static String cartNotEmpty(HttpServletRequest request, HttpServletResponse response) { - ShoppingCart cart = (ShoppingCart) request.getSession().getAttribute("shoppingCart"); - //Locale locale = UtilHttp.getLocale(request); - String errMsg = null; + ShoppingCart cart = ShoppingCartEvents.getCartObject(request); - if (cart != null && cart.size() > 0) { + if (cart != null && UtilValidate.isNotEmpty(cart.items())) { return "success"; } else { - errMsg = UtilProperties.getMessage(resource_error, "checkevents.cart_empty", (cart != null ? cart.getLocale() : Locale.getDefault())); + String errMsg = UtilProperties.getMessage(resource_error, "checkevents.cart_empty", (cart != null ? cart.getLocale() : UtilHttp.getLocale(request))); request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; }

