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 2013/06/19 09:40:59 UTC

svn commit: r1494485 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderEvents.java

Author: jleroux
Date: Wed Jun 19 07:40:59 2013
New Revision: 1494485

URL: http://svn.apache.org/r1494485
Log:
A patch from Leon for "no error message displayed if there's any exception while cancel selected order items" https://issues.apache.org/jira/browse/OFBIZ-5231

Select one order item, and click "cancel selected items" link-button, if exception occurs, the exception message doses not display as expected.
I added the "locale" before invoke "cancelOrderItem" service in attached patch.

jleroux: I did not test but this makes sense since, in case of GenericServiceException, resultMap will not be available. The result on screen will maybe be ugly but at least something will show

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderEvents.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderEvents.java?rev=1494485&r1=1494484&r2=1494485&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderEvents.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderEvents.java Wed Jun 19 07:40:59 2013
@@ -21,6 +21,7 @@ package org.ofbiz.order.order;
 import java.io.IOException;
 import java.io.OutputStream;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 import javax.servlet.ServletContext;
@@ -103,6 +104,7 @@ public class OrderEvents {
         Delegator delegator = (Delegator) request.getAttribute("delegator");
         HttpSession session = request.getSession();
         GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");
+        Locale locale = UtilHttp.getLocale(request);
 
         Map<String, Object> resultMap = FastMap.newInstance();
         String  orderId = request.getParameter("orderId");
@@ -122,6 +124,7 @@ public class OrderEvents {
                         contextMap.put("orderItemSeqId", orderItemSeqId);
                         contextMap.put("shipGroupSeqId", shipGroupSeqId);
                         contextMap.put("userLogin", userLogin);
+                        contextMap.put("locale", locale);
                         try {
                             resultMap = dispatcher.runSync("cancelOrderItem", contextMap);
 
@@ -134,7 +137,7 @@ public class OrderEvents {
 
                         } catch (GenericServiceException e) {
                             Debug.logError(e, module);
-                            request.setAttribute("_ERROR_MESSAGE_", resultMap.get("errorMessage"));
+                            request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
                             return "error";
                         }
                     }