svn commit: r545410 - /ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java

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

svn commit: r545410 - /ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java

jacopoc
Author: jacopoc
Date: Thu Jun  7 22:04:25 2007
New Revision: 545410

URL: http://svn.apache.org/viewvc?view=rev&rev=545410
Log:
Applied (slightly different) patch from Andrew Sykes to change a direct call to the createInvoiceForOrder method into a service call. OFBIZ-1060

Modified:
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?view=diff&rev=545410&r1=545409&r2=545410
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Thu Jun  7 22:04:25 2007
@@ -113,6 +113,7 @@
     // service to create an invoice for a complete order by the system userid
     public static Map createInvoiceForOrderAllItems(DispatchContext dctx, Map context) {
         GenericDelegator delegator = dctx.getDelegator();
+        LocalDispatcher dispatcher = dctx.getDispatcher();
         try {
             List orderItems = delegator.findByAnd("OrderItem", UtilMisc.toMap("orderId", (String) context.get("orderId")));
             if (orderItems != null && orderItems.size() > 0) {
@@ -123,13 +124,18 @@
             if (userLogin != null) {
                 context.put("userLogin", userLogin);
             }
-            
+
+            return dispatcher.runSync("createInvoiceForOrder", context);
+        }
+        catch(GenericServiceException e) {
+            String errMsg = UtilProperties.getMessage(resource,"AccountingEntityDataProblemCreatingInvoiceFromOrderItems",UtilMisc.toMap("reason",e.toString()),(Locale) context.get("locale"));
+            Debug.logError (e, errMsg, module);
+            return ServiceUtil.returnError(errMsg);            
         } catch (GenericEntityException e) {
             String errMsg = UtilProperties.getMessage(resource,"AccountingEntityDataProblemCreatingInvoiceFromOrderItems",UtilMisc.toMap("reason",e.toString()),(Locale) context.get("locale"));
             Debug.logError(e, errMsg, module);
             return ServiceUtil.returnError(errMsg);
         }
-        return createInvoiceForOrder(dctx, context);
     }
 
     /* Service to create an invoice for an order */