You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2014/03/19 08:10:44 UTC
svn commit: r1579155 -
/ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
Author: jacopoc
Date: Wed Mar 19 07:10:43 2014
New Revision: 1579155
URL: http://svn.apache.org/r1579155
Log:
This should fix (and hopefully make it more readable) the code that was supposed to handle payment to invoice applications with different currencies but it was broken: see the bug report by Adrian Stern OFBIZ-5576.
The fix is in the spirit of the original code that is handling the fields Payment.actualCurrencyUomId and Payment.actualCurrencyAmount: however in my opinion this is a wrong design; unfortunately I don't have time now to refactor this code.
Modified:
ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
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=1579155&r1=1579154&r2=1579155&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 Wed Mar 19 07:10:43 2014
@@ -183,34 +183,36 @@ under the License.
<if-not-empty field="parameters.invoiceId">
<!-- get the invoice and do some further validation against it -->
<entity-one entity-name="Invoice" value-field="invoice"/>
- <!-- check the currencies if they are compatible -->
- <property-to-field field="defaultCurrencyUomId" resource="general" property="currency.uom.id.default" default="USD"/>
+ <!-- check the currencies if they are compatible -->
<if>
<condition>
- <or>
- <if-compare-field field="invoice.currencyUomId" operator="equals" to-field="defaultCurrencyUomId"/>
- <and>
- <if-compare-field field="invoice.currencyUomId" operator="not-equals" to-field="defaultCurrencyUomId"/>
- <if-compare-field field="invoice.currencyUomId" operator="equals" to-field="payment.actualCurrencyUomId"/>
- </and>
- </or>
+ <and>
+ <if-compare-field field="invoice.currencyUomId" operator="not-equals" to-field="payment.currencyUomId"/>
+ <if-compare-field field="invoice.currencyUomId" operator="not-equals" to-field="payment.actualCurrencyUomId"/>
+ </and>
</condition>
- <then><!-- if required get the payment amount in foreign currency (local we already have) -->
- <if-compare-field field="invoice.currencyUomId" operator="not-equals" to-field="defaultCurrencyUomId">
- <set field="actual" value="true" type="Boolean"/>
- <call-class-method method-name="getPaymentNotApplied" class-name="org.ofbiz.accounting.payment.PaymentWorker" ret-field="notAppliedPayment">
- <field field="payment" type="GenericValue"/>
- <field field="actual" type="Boolean"/>
- </call-class-method>
- </if-compare-field>
- </then>
- <else>
+ <then>
<add-error>
<fail-property resource="AccountingUiLabels" property="AccountingCurrenciesOfInvoiceAndPaymentNotCompatible"/>
</add-error>
- </else>
+ </then>
</if>
<check-errors/>
+ <if>
+ <condition>
+ <and>
+ <if-compare-field field="invoice.currencyUomId" operator="not-equals" to-field="payment.currencyUomId"/>
+ <if-compare-field field="invoice.currencyUomId" operator="equals" to-field="payment.actualCurrencyUomId"/>
+ </and>
+ </condition>
+ <then><!-- if required get the payment amount in foreign currency (local we already have) -->
+ <set field="actual" value="true" type="Boolean"/>
+ <call-class-method method-name="getPaymentNotApplied" class-name="org.ofbiz.accounting.payment.PaymentWorker" ret-field="notAppliedPayment">
+ <field field="payment" type="GenericValue"/>
+ <field field="actual" type="Boolean"/>
+ </call-class-method>
+ </then>
+ </if>
<!-- get the amount that has not been applied yet for the invoice (outstanding amount) -->
<call-class-method method-name="getInvoiceNotApplied" class-name="org.ofbiz.accounting.invoice.InvoiceWorker" ret-field="notAppliedInvoice">