svn commit: r680167 - /ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderHistory.groovy

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

svn commit: r680167 - /ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderHistory.groovy

jleroux@apache.org
Author: jleroux
Date: Sun Jul 27 12:19:30 2008
New Revision: 680167

URL: http://svn.apache.org/viewvc?rev=680167&view=rev
Log:
Fix a bug (from bsh->groovy)

Modified:
    ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderHistory.groovy

Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderHistory.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderHistory.groovy?rev=680167&r1=680166&r2=680167&view=diff
==============================================================================
--- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderHistory.groovy (original)
+++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/WEB-INF/actions/order/OrderHistory.groovy Sun Jul 27 12:19:30 2008
@@ -23,14 +23,20 @@
 import org.ofbiz.entity.condition.*;
 
 partyRole = delegator.findByPrimaryKey("PartyRole", [partyId : userLogin.partyId, roleTypeId : "SUPPLIER"]);
-if("SUPPLIER".equals(partyRole.roleTypeId)){
-    /** drop shipper or supplier **/
-    porderRoleCollection = delegator.findByAnd("OrderRole", [partyId : userLogin.partyId, roleTypeId : "SUPPLIER_AGENT"]);
-    porderHeaderList = EntityUtil.orderBy(EntityUtil.filterByAnd(EntityUtil.getRelated("OrderHeader", porderRoleCollection), [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"), EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "PURCHASE_ORDER")]), ["orderDate DESC"]);
-    context.porderHeaderList = porderHeaderList;
+if (partyRole) {
+    if("SUPPLIER".equals(partyRole.roleTypeId)){
+        /** drop shipper or supplier **/
+        porderRoleCollection = delegator.findByAnd("OrderRole", [partyId : userLogin.partyId, roleTypeId : "SUPPLIER_AGENT"]);
+        porderHeaderList = EntityUtil.orderBy(EntityUtil.filterByAnd(EntityUtil.getRelated("OrderHeader", porderRoleCollection),
+                [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED"),
+                 EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, "PURCHASE_ORDER")]),
+                 ["orderDate DESC"]);
+        context.porderHeaderList = porderHeaderList;
+    }
 }
 orderRoleCollection = delegator.findByAnd("OrderRole", [partyId : userLogin.partyId, roleTypeId : "PLACING_CUSTOMER"]);
-orderHeaderList = EntityUtil.orderBy(EntityUtil.filterByAnd(EntityUtil.getRelated("OrderHeader", orderRoleCollection), [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED")]), ["orderDate DESC"]);
+orderHeaderList = EntityUtil.orderBy(EntityUtil.filterByAnd(EntityUtil.getRelated("OrderHeader", orderRoleCollection),
+        [EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "ORDER_REJECTED")]), ["orderDate DESC"]);
 context.orderHeaderList = orderHeaderList;
 
 downloadOrderRoleAndProductContentInfoList = delegator.findByAnd("OrderRoleAndProductContentInfo",