Author: hansbak
Date: Thu Oct 2 01:24:08 2008
New Revision: 701030
URL:
http://svn.apache.org/viewvc?rev=701030&view=revLog:
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()) {