svn commit: r701030 - /ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java

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

svn commit: r701030 - /ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java

hansbak-2
Author: hansbak
Date: Thu Oct  2 01:24:08 2008
New Revision: 701030

URL: http://svn.apache.org/viewvc?rev=701030&view=rev
Log:
need to list paymentapplications on both payment fields

Modified:
    ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java

Modified: ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java?rev=701030&r1=701029&r2=701030&view=diff
==============================================================================
--- ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java (original)
+++ ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/payment/PaymentWorker.java Thu Oct  2 01:24:08 2008
@@ -40,6 +40,11 @@
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.util.EntityUtil;
+import org.ofbiz.entity.condition.EntityCondition;
+import org.ofbiz.entity.condition.EntityOperator;
+import org.ofbiz.entity.condition.EntityExpr;
+import org.ofbiz.entity.condition.EntityConditionList;
+
 
 /**
  * Worker methods for Payments
@@ -293,7 +298,12 @@
         BigDecimal paymentApplied = BigDecimal.ZERO;
         List paymentApplications = null;
         try {
-            paymentApplications = payment.getRelated("PaymentApplication");
+            List cond = UtilMisc.toList(
+             EntityCondition.makeCondition("paymentId", EntityOperator.EQUALS, payment.getString("paymentId")),
+             EntityCondition.makeCondition("toPaymentId", EntityOperator.EQUALS, payment.getString("paymentId"))
+             );
+            EntityCondition partyCond = EntityCondition.makeCondition(cond, EntityOperator.OR);
+            paymentApplications = payment.getDelegator().findList("PaymentApplication", partyCond, null, UtilMisc.toList("invoiceId", "billingAccountId"), null, false);
             if (UtilValidate.isNotEmpty(paymentApplications)) {
                 Iterator p = paymentApplications.iterator();
                 while (p.hasNext()) {