[OFBiz] SVN: r6068 - trunk/applications/order/src/org/ofbiz/order/shoppingcart

jacopo at svn.ofbiz.org jacopo at svn.ofbiz.org
Fri Nov 4 11:11:27 EST 2005


Author: jacopo
Date: 2005-11-04 10:11:21 -0600 (Fri, 04 Nov 2005)
New Revision: 6068

Modified:
   trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
Log:
Quote roles are now propagated to order roles when a quote is transformed in an order.

Modified: trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java
===================================================================
--- trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java	2005-11-04 15:04:40 UTC (rev 6067)
+++ trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java	2005-11-04 16:11:21 UTC (rev 6068)
@@ -403,20 +403,41 @@
             return ServiceUtil.returnError(e.getMessage());
         }
 
-        // set the role information
-        cart.setOrderPartyId(quote.getString("partyId"));
-
         cart.setQuoteId(quoteId);
         
         List quoteItems = null;
         List quoteAdjs = null;
+        List quoteRoles = null;
         try {
             quoteItems = quote.getRelated("QuoteItem");
             quoteAdjs = quote.getRelated("QuoteAdjustment");
+            quoteRoles = quote.getRelated("QuoteRole");
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
             return ServiceUtil.returnError(e.getMessage());
         }
+        // set the role information
+        cart.setOrderPartyId(quote.getString("partyId"));
+        if (quoteRoles != null) {
+            Iterator quoteRolesIt = quoteRoles.iterator();
+            while (quoteRolesIt.hasNext()) {
+                GenericValue quoteRole = (GenericValue)quoteRolesIt.next();
+                String quoteRoleTypeId = quoteRole.getString("roleTypeId");
+                String quoteRolePartyId = quoteRole.getString("partyId");
+                if ("PLACING_CUSTOMER".equals(quoteRoleTypeId)) {
+                    cart.setPlacingCustomerPartyId(quoteRolePartyId);
+                } else if ("BILL_TO_CUSTOMER".equals(quoteRoleTypeId)) {
+                    cart.setBillToCustomerPartyId(quoteRolePartyId);
+                } else if ("SHIP_TO_CUSTOMER".equals(quoteRoleTypeId)) {
+                    cart.setShipToCustomerPartyId(quoteRolePartyId);
+                } else if ("END_USER_CUSTOMER".equals(quoteRoleTypeId)) {
+                    cart.setEndUserCustomerPartyId(quoteRolePartyId);
+                } else {
+                    cart.addAdditionalPartyRole(quoteRolePartyId, quoteRoleTypeId);
+                }
+            }
+        }
+
         // Convert the quote adjustment to order header adjustments and
         // put them in a map: the key/values pairs are quoteItemSeqId/List of adjs
         Map orderAdjsMap = new HashMap();



More information about the Svn mailing list