You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2014/06/25 13:39:54 UTC

svn commit: r1605354 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java

Author: jleroux
Date: Wed Jun 25 11:39:53 2014
New Revision: 1605354

URL: http://svn.apache.org/r1605354
Log:
A patch from  Sebastian Leitner  for "Anonymous customer looses locale on order" https://issues.apache.org/jira/browse/OFBIZ-5666

If an anonymous customer changes his/her locale (/control/setSessionLocale) and then places an order in an ecommerce-application, the event ShoppingCartEvents.clearCart(HttpServletRequest, HttpServletResponse) invalidates the session and creates a new one. Due to that the previous locale-switch is lost and is set back to browser- or server-default.

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.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=1605354&r1=1605353&r2=1605354&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 Wed Jun 25 11:39:53 2014
@@ -904,9 +904,14 @@ public class ShoppingCartEvents {
         HttpSession session = request.getSession();
         GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");
         if (userLogin != null && "anonymous".equals(userLogin.get("userLoginId"))) {
+        	Locale locale = UtilHttp.getLocale(session);
+        	
             // here we want to do a full logout, but not using the normal logout stuff because it saves things in the UserLogin record that we don't want changed for the anonymous user
             session.invalidate();
             session = request.getSession(true);
+            if (null != locale) {
+            	UtilHttp.setLocale(session, locale);
+            }
 
             // to allow the display of the order confirmation page put the userLogin in the request, but leave it out of the session
             request.setAttribute("temporaryAnonymousUserLogin", userLogin);