svn commit: r433731 - /incubator/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: r433731 - /incubator/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java

sichen
Author: sichen
Date: Tue Aug 22 12:34:21 2006
New Revision: 433731

URL: http://svn.apache.org/viewvc?rev=433731&view=rev
Log:
Fix bug where checkInvoicePayments would throw an exception if there is a PaymentApplication without invoiceId (ie, a tax payment or billing account receipt)

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

Modified: incubator/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
URL: http://svn.apache.org/viewvc/incubator/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=433731&r1=433730&r2=433731&view=diff
==============================================================================
--- incubator/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java (original)
+++ incubator/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java Tue Aug 22 12:34:21 2006
@@ -2390,14 +2390,16 @@
             if (payment == null) throw new GenericServiceException("Payment with ID [" + paymentId  + "] not found!");
 
             List paymentApplications = payment.getRelated("PaymentApplication");
-            if (paymentApplications == null) return ServiceUtil.returnSuccess();
+            if (UtilValidate.isEmpty(paymentApplications)) return ServiceUtil.returnSuccess();
 
             Iterator iter = paymentApplications.iterator();
             while (iter.hasNext()) {
                 GenericValue paymentApplication = (GenericValue) iter.next();
                 String invoiceId = paymentApplication.getString("invoiceId");
-                Map serviceResult = dispatcher.runSync("checkInvoicePaymentApplications", UtilMisc.toMap("invoiceId", invoiceId, "userLogin", userLogin));
-                if (ServiceUtil.isError(serviceResult)) return serviceResult;
+                if (invoiceId != null) {
+                    Map serviceResult = dispatcher.runSync("checkInvoicePaymentApplications", UtilMisc.toMap("invoiceId", invoiceId, "userLogin", userLogin));
+                    if (ServiceUtil.isError(serviceResult)) return serviceResult;
+                }
             }
             return ServiceUtil.returnSuccess();
         } catch (GenericServiceException se) {