svn commit: r786509 - /ofbiz/branches/release09.04/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderStatus.groovy

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

svn commit: r786509 - /ofbiz/branches/release09.04/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderStatus.groovy

ashish-18
Author: ashish
Date: Fri Jun 19 13:53:24 2009
New Revision: 786509

URL: http://svn.apache.org/viewvc?rev=786509&view=rev
Log:
Applied fix from trunk revision: 786507
Applied patch from jira issue OFBIZ-2637 (Content of Order Complete mail shows "Order not found with ID [OrderId]" when order is placed by anonymous user from front-end store, and completed by admin.)
Thanks Divesh for your contribution.

Modified:
    ofbiz/branches/release09.04/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderStatus.groovy

Modified: ofbiz/branches/release09.04/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderStatus.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/release09.04/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderStatus.groovy?rev=786509&r1=786508&r2=786509&view=diff
==============================================================================
--- ofbiz/branches/release09.04/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderStatus.groovy (original)
+++ ofbiz/branches/release09.04/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderStatus.groovy Fri Jun 19 13:53:24 2009
@@ -29,10 +29,24 @@
 import org.ofbiz.product.store.*;
 
 orderId = parameters.orderId;
-
+orderHeader = null;
 // we have a special case here where for an anonymous order the user will already be logged out, but the userLogin will be in the request so we can still do a security check here
 if (!userLogin) {
     userLogin = parameters.temporaryAnonymousUserLogin;
+    // This is another special case, when Order is placed by anonymous user from ecommerce and then Order is completed by admin(or any user) from Order Manager
+    // then userLogin is not found when Order Complete Mail is send to user.
+    if (!userLogin) {
+        if (orderId) {
+            orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false);
+            orderStatuses = orderHeader.getRelated("OrderStatus");
+            orderStatuses.each { orderStatus ->
+                if ("ORDER_COMPLETED".equals(orderStatus.statusId)) {
+                    statusUserLogin = orderStatus.statusUserLogin;
+                    userLogin = delegator.findOne("UserLogin", [userLoginId :statusUserLogin], false);
+                }
+            }
+        }
+    }
     context.userLogin = userLogin;
 }
 
@@ -50,7 +64,6 @@
 // can anybody view an anonymous order?  this is set in the screen widget and should only be turned on by an email confirmation screen
 allowAnonymousView = context.allowAnonymousView;
 
-orderHeader = null;
 isDemoStore = true;
 if (orderId) {
     orderHeader = delegator.findByPrimaryKey("OrderHeader", [orderId : orderId]);