[OFBiz] SVN: r7878 - trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order

jacopo@svn.ofbiz.org jacopo at svn.ofbiz.org
Tue Jun 27 09:03:01 CDT 2006


Author: jacopo
Date: 2006-06-27 09:02:52 -0500 (Tue, 27 Jun 2006)
New Revision: 7878

Modified:
   trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/companyHeader.bsh
Log:
The Company's partyId for the header file is now retrieved from the OrderRole entity (instead of ProductStore).

Modified: trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/companyHeader.bsh
===================================================================
--- trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/companyHeader.bsh	2006-06-27 13:12:33 UTC (rev 7877)
+++ trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/companyHeader.bsh	2006-06-27 14:02:52 UTC (rev 7878)
@@ -62,8 +62,18 @@
 
 if (orderHeader != null) {
     GenericValue productStore = (GenericValue) orderHeader.getRelatedOne("ProductStore");
-    if (orderHeader.getString("orderTypeId").equals("SALES_ORDER") && productStore != null && productStore.get("payToPartyId") != null) {
-        partyId = productStore.getString("payToPartyId");
+    if (orderHeader.getString("orderTypeId").equals("SALES_ORDER")) {
+        GenericValue billFromVendor = EntityUtil.getFirst(orderHeader.getRelatedByAnd("OrderRole", UtilMisc.toMap("roleTypeId", "BILL_FROM_VENDOR")));
+        if (billFromVendor != null) {
+            partyId = billFromVendor.getString("partyId");
+        } else if (productStore != null && productStore.get("payToPartyId") != null) {
+            partyId = productStore.getString("payToPartyId");
+        }
+    } else if (orderHeader.getString("orderTypeId").equals("PURCHASE_ORDER")) {
+        GenericValue billToCustomer = EntityUtil.getFirst(orderHeader.getRelatedByAnd("OrderRole", UtilMisc.toMap("roleTypeId", "BILL_TO_CUSTOMER")));
+        if (billToCustomer != null) {
+            partyId = billToCustomer.getString("partyId");
+        }
     }
 } else if (invoice != null) {
     if (invoice.get("invoiceTypeId").equals("SALES_INVOICE") && invoice.get("partyIdFrom") != null) {



More information about the Svn mailing list