You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jo...@apache.org on 2011/03/25 15:54:42 UTC

svn commit: r1085416 - /ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java

Author: jonesde
Date: Fri Mar 25 14:54:42 2011
New Revision: 1085416

URL: http://svn.apache.org/viewvc?rev=1085416&view=rev
Log:
Added code to saveUpdatedCartToOrder to save billingAccountId from cart if cart has one

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1085416&r1=1085415&r2=1085416&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Fri Mar 25 14:54:42 2011
@@ -3942,7 +3942,9 @@ public class OrderServices {
         return result;
     }
 
-    private static void saveUpdatedCartToOrder(LocalDispatcher dispatcher, Delegator delegator, ShoppingCart cart, Locale locale, GenericValue userLogin, String orderId, Map<String, Object> changeMap, boolean calcTax, boolean deleteItems) throws GeneralException {
+    private static void saveUpdatedCartToOrder(LocalDispatcher dispatcher, Delegator delegator, ShoppingCart cart,
+            Locale locale, GenericValue userLogin, String orderId, Map<String, Object> changeMap, boolean calcTax,
+            boolean deleteItems) throws GeneralException {
         // get/set the shipping estimates.  if it's a SALES ORDER, then return an error if there are no ship estimates
         int shipGroups = cart.getShipGroupSize();
         for (int gi = 0; gi < shipGroups; gi++) {
@@ -3987,6 +3989,19 @@ public class OrderServices {
             throw new GeneralException(ServiceUtil.getErrorMessage(validateResp));
         }
 
+        // handle OrderHeader fields
+        String billingAccountId = cart.getBillingAccountId();
+        if (UtilValidate.isNotEmpty(billingAccountId)) {
+            try {
+                GenericValue orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId));
+                orderHeader.set("billingAccountId", billingAccountId);
+                toStore.add(orderHeader);
+            } catch (GenericEntityException e) {
+                Debug.logError(e, module);
+                throw new GeneralException(e.getMessage());
+            }
+        }
+
         toStore.addAll(cart.makeOrderItems());
         toStore.addAll(cart.makeAllAdjustments());