svn commit: r884903 - /ofbiz/trunk/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: r884903 - /ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderStatus.groovy

ashish-18
Author: ashish
Date: Fri Nov 27 16:21:26 2009
New Revision: 884903

URL: http://svn.apache.org/viewvc?rev=884903&view=rev
Log:
Order confirmation email gives following content when any party doesn't have userlogin associated with it.

Order Confirmation Notice

NOTE: This is a DEMO store-front. Orders placed here will NOT be billed, and will NOT be fulfilled.
Order not found with ID [WSCO10040], or not allowed to view.

Thanks Akash for the contribution - Good find.

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=884903&r1=884902&r2=884903&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 Nov 27 16:21:26 2009
@@ -39,10 +39,18 @@
         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);
+            filteredOrderStatusList = EntityUtil.filterByCondition(orderStatuses, EntityCondition.makeCondition("statusId", EntityOperator.IN, ["ORDER_COMPLETED", "ORDER_APPROVED"]));
+            if (UtilValidate.isNotEmpty(filteredOrderStatusList)) {
+                if (filteredOrderStatusList.size() < 2) {
+                    statusUserLogin = EntityUtil.getFirst(filteredOrderStatusList).statusUserLogin;
+                    userLogin = delegator.findOne("UserLogin", [userLoginId : statusUserLogin], false);
+                } else {
+                    filteredOrderStatusList.each { orderStatus ->
+                        if ("ORDER_COMPLETED".equals(orderStatus.statusId)) {
+                            statusUserLogin = orderStatus.statusUserLogin;
+                            userLogin = delegator.findOne("UserLogin", [userLoginId :statusUserLogin], false);
+                        }
+                    }
                 }
             }
         }