Author: jacopoc
Date: Wed Mar 19 07:33:47 2014 New Revision: 1579158 URL: http://svn.apache.org/r1579158 Log: Applied fix from trunk for revision: 1579155 === 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/branches/release12.04/ (props changed) ofbiz/branches/release12.04/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml Propchange: ofbiz/branches/release12.04/ ------------------------------------------------------------------------------ Merged /ofbiz/trunk:r1579155 Modified: ofbiz/branches/release12.04/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml?rev=1579158&r1=1579157&r2=1579158&view=diff ============================================================================== --- ofbiz/branches/release12.04/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml (original) +++ ofbiz/branches/release12.04/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml Wed Mar 19 07:33:47 2014 @@ -177,34 +177,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"> |
Free forum by Nabble | Edit this page |