svn commit: r573665 - in /ofbiz/trunk/applications/order: config/ data/ servicedef/ src/org/ofbiz/order/order/ webapp/ordermgr/WEB-INF/ webapp/ordermgr/order/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r573665 - in /ofbiz/trunk/applications/order: config/ data/ servicedef/ src/org/ofbiz/order/order/ webapp/ordermgr/WEB-INF/ webapp/ordermgr/order/

jaz-3
Author: jaz
Date: Fri Sep  7 11:38:36 2007
New Revision: 573665

URL: http://svn.apache.org/viewvc?rev=573665&view=rev
Log:
added mass order change for hold/process/cancel

Modified:
    ofbiz/trunk/applications/order/config/OrderUiLabels.properties
    ofbiz/trunk/applications/order/data/OrderTypeData.xml
    ofbiz/trunk/applications/order/servicedef/services.xml
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
    ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
    ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl

Modified: ofbiz/trunk/applications/order/config/OrderUiLabels.properties
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/config/OrderUiLabels.properties?rev=573665&r1=573664&r2=573665&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/config/OrderUiLabels.properties (original)
+++ ofbiz/trunk/applications/order/config/OrderUiLabels.properties Fri Sep  7 11:38:36 2007
@@ -429,6 +429,7 @@
 OrderBillingAddress=Billing Address
 OrderCancelAllItems=Cancel all Items
 OrderCancelled=Cancelled
+OrderCancelOrder=Cancel Order
 OrderCannotBeChanged=(cannot be changed without clearing order.)
 OrderCardSecurityCode=Card Security Code
 OrderCartTotal=Cart Total
@@ -703,6 +704,7 @@
 OrderProcessingInHoldNote=** Note: If this state is a result of an automated activity, releasing may not have an effect until all conditions are met.
 OrderProcessingStatus=Processing Status
 OrderProcessingTransitions=Processing Transitions
+OrderProcessOrder=Process Order
 OrderProductStore=Product Store
 OrderPromotionCouponCodes=Promotion/Coupon Codes
 OrderPurchaseOrder=Purchase Order

Modified: ofbiz/trunk/applications/order/data/OrderTypeData.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/data/OrderTypeData.xml?rev=573665&r1=573664&r2=573665&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/data/OrderTypeData.xml (original)
+++ ofbiz/trunk/applications/order/data/OrderTypeData.xml Fri Sep  7 11:38:36 2007
@@ -119,17 +119,19 @@
     <StatusValidChange condition="" statusId="ORDER_CREATED" statusIdTo="ORDER_HOLD" transitionName="Hold Order"/>
     <StatusValidChange condition="" statusId="ORDER_CREATED" statusIdTo="ORDER_REJECTED" transitionName="Reject Order"/>
     <StatusValidChange condition="" statusId="ORDER_CREATED" statusIdTo="ORDER_CANCELLED" transitionName="Cancel Order"/>
+    <StatusValidChange condition="" statusId="ORDER_PROCESSING" statusIdTo="ORDER_HOLD" transitionName="Hold Order"/>
     <StatusValidChange condition="" statusId="ORDER_PROCESSING" statusIdTo="ORDER_APPROVED" transitionName="Approve Order"/>
     <StatusValidChange condition="" statusId="ORDER_PROCESSING" statusIdTo="ORDER_REJECTED" transitionName="Reject Order"/>
     <StatusValidChange condition="" statusId="ORDER_PROCESSING" statusIdTo="ORDER_CANCELLED" transitionName="Cancel Order"/>
     <StatusValidChange condition="" statusId="ORDER_APPROVED" statusIdTo="ORDER_SENT" transitionName="Send Order"/>
-    <StatusValidChange condition="" statusId="ORDER_APPROVED" statusIdTo="ORDER_PROCESSING" transitionName="Hold Order"/>
+    <StatusValidChange condition="" statusId="ORDER_APPROVED" statusIdTo="ORDER_PROCESSING" transitionName="Process Order"/>
     <StatusValidChange condition="" statusId="ORDER_APPROVED" statusIdTo="ORDER_COMPLETED" transitionName="Complete Order"/>
     <StatusValidChange condition="" statusId="ORDER_APPROVED" statusIdTo="ORDER_CANCELLED" transitionName="Cancel Order"/>
     <StatusValidChange condition="" statusId="ORDER_APPROVED" statusIdTo="ORDER_HOLD" transitionName="Hold Order"/>
+    <StatusValidChange condition="" statusId="ORDER_HOLD" statusIdTo="ORDER_PROCESSING" transitionName="Process Order"/>
     <StatusValidChange condition="" statusId="ORDER_HOLD" statusIdTo="ORDER_APPROVED" transitionName="Approve Order"/>
-    <StatusValidChange condition="" statusId="ORDER_SENT" statusIdTo="ORDER_COMPLETED" transitionName="Order Completed"/>
     <StatusValidChange condition="" statusId="ORDER_HOLD" statusIdTo="ORDER_CANCELLED" transitionName="Cancel Order"/>
+    <StatusValidChange condition="" statusId="ORDER_SENT" statusIdTo="ORDER_COMPLETED" transitionName="Order Completed"/>
     <StatusValidChange condition="" statusId="ORDER_SENT" statusIdTo="ORDER_CANCELLED" transitionName="Order Cancelled"/>
     <StatusValidChange condition="" statusId="ITEM_CREATED" statusIdTo="ITEM_APPROVED" transitionName="Approve Item"/>
     <StatusValidChange condition="" statusId="ITEM_CREATED" statusIdTo="ITEM_REJECTED" transitionName="Reject Item"/>

Modified: ofbiz/trunk/applications/order/servicedef/services.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/servicedef/services.xml?rev=573665&r1=573664&r2=573665&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/servicedef/services.xml (original)
+++ ofbiz/trunk/applications/order/servicedef/services.xml Fri Sep  7 11:38:36 2007
@@ -548,6 +548,18 @@
             location="org.ofbiz.order.order.OrderServices" invoke="massChangeApproved" auth="true">
         <implements service="massOrderChangeInterface"/>
     </service>
+    <service name="massProcessOrders" engine="java" transaction-timeout="300"
+            location="org.ofbiz.order.order.OrderServices" invoke="massProcessOrders" auth="true">
+        <implements service="massOrderChangeInterface"/>
+    </service>
+    <service name="massHoldOrders" engine="java" transaction-timeout="300"
+            location="org.ofbiz.order.order.OrderServices" invoke="massHoldOrders" auth="true">
+        <implements service="massOrderChangeInterface"/>
+    </service>
+    <service name="massCancelOrders" engine="java" transaction-timeout="300"
+            location="org.ofbiz.order.order.OrderServices" invoke="massCancelOrders" auth="true">
+        <implements service="massOrderChangeInterface"/>
+    </service>
     <service name="massPrintOrders" engine="java" transaction-timeout="300"
             location="org.ofbiz.order.order.OrderServices" invoke="massPrintOrders" auth="true">
         <implements service="massOrderChangeInterface"/>

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=573665&r1=573664&r2=573665&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 Sep  7 11:38:36 2007
@@ -3711,6 +3711,62 @@
     }
 
     public static Map massChangeApproved(DispatchContext dctx, Map context) {
+        return massChangeItemStatus(dctx, context, "ITEM_APPROVED");        
+    }
+
+    public static Map massCancelOrders(DispatchContext dctx, Map context) {
+        return massChangeItemStatus(dctx, context, "ITEM_CANCELLED");
+    }
+
+    public static Map massHoldOrders(DispatchContext dctx, Map context) {
+        return massChangeOrderStatus(dctx, context, "ORDER_HOLD");
+    }
+
+    public static Map massProcessOrders(DispatchContext dctx, Map context) {
+        return massChangeOrderStatus(dctx, context, "ORDER_PROCESSING");
+    }
+
+    public static Map massChangeOrderStatus(DispatchContext dctx, Map context, String statusId) {
+        LocalDispatcher dispatcher = dctx.getDispatcher();
+        GenericDelegator delegator = dctx.getDelegator();
+        GenericValue userLogin = (GenericValue) context.get("userLogin");
+        List orderIds = (List) context.get("orderIdList");
+        Iterator i = orderIds.iterator();
+        while (i.hasNext()) {
+            String orderId = (String) i.next();
+            if (UtilValidate.isEmpty(orderId)) {
+                continue;
+            }
+            GenericValue orderHeader = null;
+            try {
+                orderHeader = delegator.findByPrimaryKey("OrderHeader", UtilMisc.toMap("orderId", orderId));
+            } catch (GenericEntityException e) {
+                Debug.logError(e, module);
+                return ServiceUtil.returnError(e.getMessage());
+            }
+            if (orderHeader == null) {
+                return ServiceUtil.returnError("Order #" + orderId + " was not found.");
+            }
+
+            Map ctx = FastMap.newInstance();
+            ctx.put("statusId", statusId);
+            ctx.put("orderId", orderId);
+            ctx.put("userLogin", userLogin);
+            Map resp = null;
+            try {
+                resp = dispatcher.runSync("changeOrderStatus", ctx);
+            } catch (GenericServiceException e) {
+                Debug.logError(e, module);
+                return ServiceUtil.returnError(e.getMessage());
+            }
+            if (ServiceUtil.isError(resp)) {
+                return ServiceUtil.returnError("Error changing order item status: ", null, null, resp);
+            }
+        }
+        return ServiceUtil.returnSuccess();
+    }
+
+    public static Map massChangeItemStatus(DispatchContext dctx, Map context, String statusId) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         GenericDelegator delegator = dctx.getDelegator();
         GenericValue userLogin = (GenericValue) context.get("userLogin");
@@ -3732,9 +3788,8 @@
                 return ServiceUtil.returnError("Order #" + orderId + " was not found.");
             }
 
-            // by changing all the items to approved, the checkOrderItemStatus service will automatically set the order to approved.
             Map ctx = FastMap.newInstance();
-            ctx.put("statusId", "ITEM_APPROVED");
+            ctx.put("statusId", statusId);
             ctx.put("orderId", orderId);
             ctx.put("userLogin", userLogin);
             Map resp = null;

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml?rev=573665&r1=573664&r2=573665&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/controller.xml Fri Sep  7 11:38:36 2007
@@ -160,6 +160,24 @@
         <response name="success" type="request-redirect" value="findorders"/>
         <response name="error" type="request-redirect" value="findorders"/>
     </request-map>
+    <request-map uri="massProcessOrders">
+        <security https="true" auth="true"/>
+        <event type="service" path="" invoke="massProcessOrders"/>
+        <response name="success" type="request-redirect" value="findorders"/>
+        <response name="error" type="request-redirect" value="findorders"/>
+    </request-map>
+    <request-map uri="massHoldOrders">
+        <security https="true" auth="true"/>
+        <event type="service" path="" invoke="massHoldOrders"/>
+        <response name="success" type="request-redirect" value="findorders"/>
+        <response name="error" type="request-redirect" value="findorders"/>
+    </request-map>
+    <request-map uri="massCancelOrders">
+        <security https="true" auth="true"/>
+        <event type="service" path="" invoke="massCancelOrders"/>
+        <response name="success" type="request-redirect" value="findorders"/>
+        <response name="error" type="request-redirect" value="findorders"/>
+    </request-map>
     <request-map uri="massPickOrders">
         <security https="true" auth="true"/>
         <event type="service" path="" invoke="massPickOrders"/>

Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl?rev=573665&r1=573664&r2=573665&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl (original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/findOrders.ftl Fri Sep  7 11:38:36 2007
@@ -411,6 +411,9 @@
         <select name="serviceName" class="selectBox" onchange="javascript:setServiceName(this);">
            <option value="javascript:void();">&nbsp;</option>
            <option value="<@ofbizUrl>massApproveOrders?hideFields=${requestParameters.hideFields?default("N")}${paramList}</@ofbizUrl>">${uiLabelMap.OrderApproveOrder}</option>
+           <option value="<@ofbizUrl>massHoldOrders?hideFields=${requestParameters.hideFields?default("N")}${paramList}</@ofbizUrl>">${uiLabelMap.OrderHold}</option>
+           <option value="<@ofbizUrl>massProcessOrders?hideFields=${requestParameters.hideFields?default("N")}${paramList}</@ofbizUrl>">${uiLabelMap.OrderProcessOrder}</option>
+           <option value="<@ofbizUrl>massCancelOrders?hideFields=${requestParameters.hideFields?default("N")}${paramList}</@ofbizUrl>">${uiLabelMap.OrderCancel}</option>
            <option value="<@ofbizUrl>massPickOrders?hideFields=${requestParameters.hideFields?default("N")}${paramList}</@ofbizUrl>">${uiLabelMap.OrderPickOrders}</option>
            <option value="<@ofbizUrl>massPrintOrders?hideFields=${requestParameters.hideFields?default('N')}${paramList}</@ofbizUrl>">${uiLabelMap.CommonPrint}</option>
            <option value="<@ofbizUrl>massCreateFileForOrders?hideFields=${requestParameters.hideFields?default('N')}${paramList}</@ofbizUrl>">${uiLabelMap.ContentCreateFile}</option>