Author: ashish
Date: Fri Jun 19 13:50:39 2009
New Revision: 786507
URL:
http://svn.apache.org/viewvc?rev=786507&view=revLog:
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/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderStatus.groovy
Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderStatus.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderStatus.groovy?rev=786507&r1=786506&r2=786507&view=diff==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderStatus.groovy (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderStatus.groovy Fri Jun 19 13:50:39 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]);