Author: jacopoc
Date: Sat Dec 16 02:06:36 2006 New Revision: 487781 URL: http://svn.apache.org/viewvc?view=rev&rev=487781 Log: Added link and event to initialize a cart from an existing order: this implements the ability to clone an order. The link to run it is at the bottom of the "order view" screen. Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml incubator/ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml Modified: incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?view=diff&rev=487781&r1=487780&r2=487781 ============================================================================== --- incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original) +++ incubator/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Sat Dec 16 02:06:36 2006 @@ -1038,6 +1038,34 @@ 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(); Modified: incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml?view=diff&rev=487781&r1=487780&r2=487781 ============================================================================== --- incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml (original) +++ incubator/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Sat Dec 16 02:06:36 2006 @@ -475,6 +475,12 @@ <response name="success" type="view" value="showcart"/> <response name="error" type="view" value="checkinits"/> </request-map> + <request-map uri="loadCartFromOrder"> + <security https="true" auth="true"/> + <event type="java" path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="loadCartFromOrder"/> + <response name="success" type="request" value="finalizeOrder"/> + <response name="error" type="view" value="orderview"/> + </request-map> <request-map uri="addseperator"> <security https="true" auth="true"/> <event type="java" path="org.ofbiz.order.shoppingcart.ShoppingCartEvents" invoke="addSeparator"/> Modified: incubator/ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml?view=diff&rev=487781&r1=487780&r2=487781 ============================================================================== --- incubator/ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml (original) +++ incubator/ofbiz/trunk/applications/order/widget/ordermgr/OrderViewScreens.xml Sat Dec 16 02:06:36 2006 @@ -54,6 +54,9 @@ <platform-specific> <html><html-template location="component://order/webapp/ordermgr/order/transitions.ftl"/></html> </platform-specific> + <container> + <link target="loadCartFromOrder?orderId=${parameters.orderId}&finalizeMode=init" text="${uiLabelMap.OrderCreateOrder}" style="buttontext"/> + </container> </decorator-section> </decorator-screen> </widgets> |
Free forum by Nabble | Edit this page |