Author: jleroux
Date: Wed Jun 25 11:41:31 2014
New Revision: 1605357

URL: http://svn.apache.org/r1605357
Log:
"Applied fix from trunk for revision: 1605354  " 
------------------------------------------------------------------------
r1605354 | jleroux | 2014-06-25 13:39:53 +0200 (mer. 25 juin 2014) | 3 lignes

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/branches/release12.04/   (props changed)
    
ofbiz/branches/release12.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java

Propchange: ofbiz/branches/release12.04/
------------------------------------------------------------------------------
  Merged /ofbiz/trunk:r1605354

Modified: 
ofbiz/branches/release12.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
URL: 
http://svn.apache.org/viewvc/ofbiz/branches/release12.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=1605357&r1=1605356&r2=1605357&view=diff
==============================================================================
--- 
ofbiz/branches/release12.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
 (original)
+++ 
ofbiz/branches/release12.04/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
 Wed Jun 25 11:41:31 2014
@@ -850,9 +850,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);


Reply via email to