Author: apatel
Date: Tue Jul 21 13:26:03 2009
New Revision: 796291
URL:
http://svn.apache.org/viewvc?rev=796291&view=revLog:
Optimized database calls to read payment and invoice data. Thanks Awdesh for working on it.
Modified:
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml?rev=796291&r1=796290&r2=796291&view=diff==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml Tue Jul 21 13:26:03 2009
@@ -637,8 +637,10 @@
<simple-method method-name="getInvoiceRunningTotal" short-description="calculate running total for Invoices">
<set field="invoiceIds" from-field="parameters.invoiceIds"/>
<set field="invoiceRunningTotal" type="BigDecimal" value="0"/>
- <iterate list="invoiceIds" entry="invoiceId">
- <entity-one entity-name="Invoice" value-field="invoice" auto-field-map="true"/>
+ <entity-condition entity-name="Invoice" list="invoiceList">
+ <condition-expr field-name="invoiceId" operator="in" from-field="invoiceIds"/>
+ </entity-condition>
+ <iterate list="invoiceList" entry="invoice">
<set field="getInvoicePaymentInfoListCtx.invoiceId" from-field="invoice.invoiceId"/>
<call-service service-name="getInvoicePaymentInfoList" in-map-name="getInvoicePaymentInfoListCtx">
<result-to-field result-name="invoicePaymentInfoList"/>
Modified: ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml?rev=796291&r1=796290&r2=796291&view=diff==============================================================================
--- ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml (original)
+++ ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml Tue Jul 21 13:26:03 2009
@@ -446,10 +446,10 @@
<simple-method method-name="getPaymentRunningTotal" short-description="calculate running total for payments">
<set field="paymentIds" from-field="parameters.paymentIds"/>
<set field="paymentRunningTotal" type="BigDecimal" value="0"/>
- <iterate list="paymentIds" entry="paymentId">
- <entity-one entity-name="Payment" value-field="payment">
- <field-map field-name="paymentId" from-field="paymentId"/>
- </entity-one>
+ <entity-condition entity-name="Payment" list="payments">
+ <condition-expr field-name="paymentId" operator="in" from-field="paymentIds"/>
+ </entity-condition>
+ <iterate list="payments" entry="payment">
<set field="paymentRunningTotal" value="${paymentRunningTotal + payment.amount}" type="BigDecimal"/>
</iterate>
<field-to-result field="paymentRunningTotal"/>