diff --git a/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java b/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java index 37750b9de1..6617f406dc 100644 --- a/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java +++ b/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java @@ -1038,6 +1038,34 @@ public class ShoppingCartEvents { return "success"; } + /** Initialize order entry from an existing order **/ + public static String loadCartFromOrder(HttpServletRequest request, HttpServletResponse response) { + LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); + HttpSession session = request.getSession(); + GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); + + String quoteId = request.getParameter("orderId"); + + ShoppingCart cart = null; + try { + Map outMap = dispatcher.runSync("loadCartFromOrder", + UtilMisc.toMap("orderId", quoteId, + "userLogin", userLogin)); + cart = (ShoppingCart) outMap.get("shoppingCart"); + } catch (GenericServiceException exc) { + request.setAttribute("_ERROR_MESSAGE_", exc.getMessage()); + return "error"; + } + + cart.setAttribute("addpty", "Y"); + session.setAttribute("shoppingCart", cart); + session.setAttribute("productStoreId", cart.getProductStoreId()); + session.setAttribute("orderMode", cart.getOrderType()); + session.setAttribute("orderPartyId", cart.getOrderPartyId()); + + return "success"; + } + public static String createQuoteFromCart(HttpServletRequest request, HttpServletResponse response) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); HttpSession session = request.getSession(); diff --git a/applications/order/webapp/ordermgr/WEB-INF/controller.xml b/applications/order/webapp/ordermgr/WEB-INF/controller.xml index 22fc8f31bf..fba88246ba 100644 --- a/applications/order/webapp/ordermgr/WEB-INF/controller.xml +++ b/applications/order/webapp/ordermgr/WEB-INF/controller.xml @@ -475,6 +475,12 @@ + + + + + + diff --git a/applications/order/widget/ordermgr/OrderViewScreens.xml b/applications/order/widget/ordermgr/OrderViewScreens.xml index a604be0bed..c3f9f5189a 100644 --- a/applications/order/widget/ordermgr/OrderViewScreens.xml +++ b/applications/order/widget/ordermgr/OrderViewScreens.xml @@ -54,6 +54,9 @@ under the License. + + +