Okay now I've added the following. Is this close to being right?
**********************
/soft/ofbiz/applications/order/servicedef/services.xml
---------------------------------------------
<service name="sendShipGroupToPrinter" engine="java"
location="org.ofbiz.order.order.OrderServices"
invoke="sendShipGroupToPrinter" auth="true">
<description>Sends a picking ticket to the shipping department.
Generally called by ECA rule.</description>
<attribute name="orderId" type="String" mode="IN"
optional="false"/>
</service>
*************************
/soft/ofbiz/applications/order/src/org/ofbiz/order/order/OrderServices.java
-------------------------------------------------
public static Map sendShipGroupToPrinter (DispatchContext dctx, Map
context) {
GenericDelegator delegator = dctx.getDelegator();
LocalDispatcher dispatcher = dctx.getDispatcher();
GenericValue userLogin = (GenericValue) context.get("userLogin");
Locale locale = (Locale) context.get("locale");
Map screenInMap = UtilMisc.toMap("orderId",
context.get("orderId"));
String printerName = "//somePrinterNameToBeFilledInLater";
Map outMap = UtilMisc.toMap(
"screenLocation",
"component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF",
"printerName", printerName,
"userLogin", userLogin,
"screenContext", screenInMap
);
dispatcher.runAsync("sendPrintFromScreen", inMap);
return ServiceUtil.returnSuccess();
}
David Shere wrote:
My goal is to write an ECA service that prints
component://order/widget/ordermgr/OrderPrintForms.xml#ShipGroupsPDF to a
LAN printer when an order status becomes "Order Approved. Could y'all
help me through this?
I'm starting in /soft/ofbiz/applications/order/servicedef/secas.xml
where I'm adding a new ECA:
<!-- order status changes -->
...
<eca service="changeOrderStatus" event="commit" run-on-error="false">
<condition field-name="statusId" operator="equals"
value="ORDER_APPROVED"/>
<action service="sendShipGroupToPrinter" mode="sync"/>
</eca>
am I on the right track?
--
David Shere
Information Technology Services
Steele Rubber Products
www.SteeleRubber.com