Author: jleroux
Date: Sat Jan 20 00:54:48 2007 New Revision: 498094 URL: http://svn.apache.org/viewvc?view=rev&rev=498094 Log: A patch from Jonathon Wong "Creating a purchase order allows shipping information step to be skipped" (http://issues.apache.org/jira/browse/OFBIZ-627) Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java?view=diff&rev=498094&r1=498093&r2=498094 ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java Sat Jan 20 00:54:48 2007 @@ -37,18 +37,17 @@ import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; -import org.ofbiz.webapp.stats.VisitHandler; import org.ofbiz.entity.GenericDelegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.marketing.tracking.TrackingCodeEvents; -import org.ofbiz.order.shoppingcart.shipping.ShippingEvents; import org.ofbiz.product.catalog.CatalogWorker; import org.ofbiz.product.store.ProductStoreWorker; import org.ofbiz.service.GenericServiceException; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.service.ModelService; import org.ofbiz.service.ServiceUtil; +import org.ofbiz.webapp.stats.VisitHandler; /** * Events used for processing checkout and orders. @@ -712,6 +711,8 @@ ServiceUtil.getMessages(request, callResult, null); // determine whether it was a success or not if (callResult.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_ERROR)) { + if (mode.equals("ship")) return "shipping"; + if (mode.equals("options")) return "options"; return "error"; } } @@ -841,38 +842,64 @@ List paymentMethodIds = cart.getPaymentMethodIds(); List paymentMethodTypeIds = cart.getPaymentMethodTypeIds(); - if (requireCustomer && (customerPartyId == null || customerPartyId.equals("_NA_"))) { - return "customer"; - } - - if (requireShipping && !shippingAddressSet) { - return "shipping"; - } - - if (requireShipGroups) { - return "shipGroups"; - } + String[] processOrder = {"customer", "shipping", "shipGroups", "options", "term", "payment", + "addparty", "paysplit"}; - if (requireOptions && !shippingOptionsSet) { - return "options"; - } - - if (requireTerm && !cart.isOrderTermSet()) { - return "term"; - } - if (requirePayment && (paymentMethodIds == null || paymentMethodIds.size() == 0) && (paymentMethodTypeIds == null || paymentMethodTypeIds.size() == 0)) { - return "payment"; - } - - if (requireAdditionalParty && cart.getAttribute("addpty") == null) { - return "addparty"; + if (cart.getOrderType().equals("PURCHASE_ORDER")) { + // Force checks for the following + requireCustomer = true; requireShipping = true; requireOptions = true; + requireAdditionalParty = true; + processOrder = new String[] {"customer", "term", "shipping", "shipGroups", "options", "payment", + "addparty", "paysplit"}; + } + + for (int i = 0; i < processOrder.length; i++) { + String currProcess = processOrder[i]; + if (currProcess.equals("customer")) { + if (requireCustomer && (customerPartyId == null || customerPartyId.equals("_NA_"))) { + return "customer"; + } + } + else if (currProcess.equals("shipping")) { + if (requireShipping && !shippingAddressSet) { + return "shipping"; + } + } + else if (currProcess.equals("shipGroups")) { + if (requireShipGroups) { + return "shipGroups"; + } + } + else if (currProcess.equals("options")) { + if (requireOptions && !shippingOptionsSet) { + return "options"; + } + } + else if (currProcess.equals("term")) { + if (requireTerm && !cart.isOrderTermSet()) { + return "term"; + } + } + else if (currProcess.equals("payment")) { + if (requirePayment && (paymentMethodIds == null || paymentMethodIds.size() == 0) && (paymentMethodTypeIds == null || paymentMethodTypeIds.size() == 0)) { + return "payment"; + } + } + else if (currProcess.equals("addparty")) { + if (requireAdditionalParty && cart.getAttribute("addpty") == null) { + return "addparty"; + } + } + else if (currProcess.equals("paysplit")) { + if (isSingleUsePayment) { + return "paysplit"; + } + } } - if (isSingleUsePayment) { - return "paysplit"; - } + // Finally, if all checks go through, finalize the order. - // this is used to go back to a previous page in checkout after processing all of the changes, just to make sure we get everything... + // this is used to go back to a previous page in checkout after processing all of the changes, just to make sure we get everything... String checkoutGoTo = request.getParameter("checkoutGoTo"); if (UtilValidate.isNotEmpty(checkoutGoTo)) { return checkoutGoTo; |
Free forum by Nabble | Edit this page |