diff --git a/applications/order/config/OrderUiLabels.properties b/applications/order/config/OrderUiLabels.properties index 847ebb9207..2065a1924e 100644 --- a/applications/order/config/OrderUiLabels.properties +++ b/applications/order/config/OrderUiLabels.properties @@ -429,6 +429,7 @@ OrderBeSureIncludeOrder=Be sure to include your order 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 @@ OrderProcessingInHold=This order is currently in a 'Hold' state. The activity ha 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 diff --git a/applications/order/data/OrderTypeData.xml b/applications/order/data/OrderTypeData.xml index ecf929694b..bf7eeb5496 100644 --- a/applications/order/data/OrderTypeData.xml +++ b/applications/order/data/OrderTypeData.xml @@ -119,17 +119,19 @@ under the License. + - + + - + diff --git a/applications/order/servicedef/services.xml b/applications/order/servicedef/services.xml index 634114dfba..b7a0990f73 100644 --- a/applications/order/servicedef/services.xml +++ b/applications/order/servicedef/services.xml @@ -548,6 +548,18 @@ under the License. location="org.ofbiz.order.order.OrderServices" invoke="massChangeApproved" auth="true"> + + + + + + + + + diff --git a/applications/order/src/org/ofbiz/order/order/OrderServices.java b/applications/order/src/org/ofbiz/order/order/OrderServices.java index 87cca3d095..3187daf47f 100644 --- a/applications/order/src/org/ofbiz/order/order/OrderServices.java +++ b/applications/order/src/org/ofbiz/order/order/OrderServices.java @@ -3711,6 +3711,22 @@ public class OrderServices { } 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"); @@ -3732,9 +3748,48 @@ public class OrderServices { 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; + 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"); + 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; diff --git a/applications/order/webapp/ordermgr/WEB-INF/controller.xml b/applications/order/webapp/ordermgr/WEB-INF/controller.xml index f09dfe7fc1..702f4858a3 100644 --- a/applications/order/webapp/ordermgr/WEB-INF/controller.xml +++ b/applications/order/webapp/ordermgr/WEB-INF/controller.xml @@ -160,6 +160,24 @@ under the License. + + + + + + + + + + + + + + + + + + diff --git a/applications/order/webapp/ordermgr/order/findOrders.ftl b/applications/order/webapp/ordermgr/order/findOrders.ftl index 9b8cee2936..84a8499c18 100644 --- a/applications/order/webapp/ordermgr/order/findOrders.ftl +++ b/applications/order/webapp/ordermgr/order/findOrders.ftl @@ -411,6 +411,9 @@ document.lookuporder.orderId.focus();