Skip to content

Commit

Permalink
Added code to saveUpdatedCartToOrder to save billingAccountId from ca…
Browse files Browse the repository at this point in the history
…rt if cart has one

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1085416 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
jonesde committed Mar 25, 2011
1 parent 202085f commit 51c8485
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion applications/order/src/org/ofbiz/order/order/OrderServices.java
Original file line number Diff line number Diff line change
Expand Up @@ -3942,7 +3942,9 @@ public static Map<String, Object> saveUpdatedCartToOrder(DispatchContext dctx, M
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++) {
Expand Down Expand Up @@ -3987,6 +3989,19 @@ private static void saveUpdatedCartToOrder(LocalDispatcher dispatcher, Delegator
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());

Expand Down

0 comments on commit 51c8485

Please sign in to comment.