svn commit: r1547657 - /ofbiz/branches/release13.07/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml

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

svn commit: r1547657 - /ofbiz/branches/release13.07/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml

adrianc
Author: adrianc
Date: Wed Dec  4 00:44:16 2013
New Revision: 1547657

URL: http://svn.apache.org/r1547657
Log:
Fixed some flawed conditional logic introduced in rev 1488656.

Modified:
    ofbiz/branches/release13.07/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml

Modified: ofbiz/branches/release13.07/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml?rev=1547657&r1=1547656&r2=1547657&view=diff
==============================================================================
--- ofbiz/branches/release13.07/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml (original)
+++ ofbiz/branches/release13.07/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml Wed Dec  4 00:44:16 2013
@@ -978,31 +978,44 @@ under the License.
         <call-service service-name="getPartyAccountingPreferences" in-map-name="partyAccountingPreferencesMap">
              <result-to-field result-name="partyAccountingPreference" field="partyAcctgPreference"/>
         </call-service>
-        <if-compare-field to-field="partyAcctgPreference.baseCurrencyUomId" operator="equals" field="orderHeader.currencyUom">
-            <set field="parameters.currencyUomId" from-field="orderHeader.currencyUom"/>
-            <set field="parameters.amount" from-field="orderHeader.grandTotal"/>
-            <else>
-             <!-- get conversion rate from related invoice when exists -->
-             <entity-and list="invoices" entity-name="OrderItemBillingAndInvoiceAndItem">
-             <field-map field-name="orderId" from-field="orderId"/>
-             </entity-and>
-             <if-not-empty field="invoices">
-             <entity-one entity-name="Invoice" value-field="invoice">
-             <field-map field-name="invoiceId" from-field="invoices[0].invoiceId"/>
-             </entity-one>
-                 <set field="convertUomInMap.asOfDate" from-field="invoice.invoiceDate"/>
-             </if-not-empty>
-                <set field="convertUomInMap.originalValue" from-field="orderHeader.grandTotal"/>
-                <set field="convertUomInMap.uomId" from-field="orderHeader.currencyUom"/>
-                <set field="convertUomInMap.uomIdTo" from-field="partyAcctgPreference.baseCurrencyUomId"/>
+        <if>
+            <condition>
+                <and>
+                    <not>
+                        <if-empty field="partyAcctgPreference.baseCurrencyUomId" />
+                    </not>
+                    <if-compare-field to-field="partyAcctgPreference.baseCurrencyUomId" operator="equals" field="orderHeader.currencyUom" />
+                </and>
+            </condition>
+            <then>
+                <set field="parameters.currencyUomId" from-field="orderHeader.currencyUom" />
+                <set field="parameters.amount" from-field="orderHeader.grandTotal" />
+                <!-- get conversion rate from related invoice when exists -->
+                <entity-and list="invoices" entity-name="OrderItemBillingAndInvoiceAndItem">
+                    <field-map field-name="orderId" from-field="orderId" />
+                </entity-and>
+                <if-not-empty field="invoices">
+                    <entity-one entity-name="Invoice" value-field="invoice">
+                        <field-map field-name="invoiceId" from-field="invoices[0].invoiceId" />
+                    </entity-one>
+                    <set field="convertUomInMap.asOfDate" from-field="invoice.invoiceDate" />
+                </if-not-empty>
+                <set field="convertUomInMap.originalValue" from-field="orderHeader.grandTotal" />
+                <set field="convertUomInMap.uomId" from-field="orderHeader.currencyUom" />
+                <set field="convertUomInMap.uomIdTo" from-field="partyAcctgPreference.baseCurrencyUomId" />
+                <log message="convertUomInMap = ${convertUomInMap}" level="info" />
                 <call-service service-name="convertUom" in-map-name="convertUomInMap">
-                    <result-to-field result-name="convertedValue" field="parameters.amount"/>
+                    <result-to-field result-name="convertedValue" field="parameters.amount" />
                 </call-service>
-                <set field="parameters.actualCurrencyAmount" from-field="orderHeader.grandTotal"/>
-                <set field="parameters.actualCurrencyUomId" from-field="orderHeader.currencyUom"/>
-                <set field="parameters.currencyUomId" from-field="partyAcctgPreference.baseCurrencyUomId"/>
+                <set field="parameters.actualCurrencyAmount" from-field="orderHeader.grandTotal" />
+                <set field="parameters.actualCurrencyUomId" from-field="orderHeader.currencyUom" />
+                <set field="parameters.currencyUomId" from-field="partyAcctgPreference.baseCurrencyUomId" />
+            </then>
+            <else>
+                <set field="parameters.currencyUomId" from-field="orderHeader.currencyUom" />
+                <set field="parameters.amount" from-field="orderHeader.grandTotal" />
             </else>
-        </if-compare-field>
+        </if>
         
         <set field="parameters.partyIdFrom" from-field="orderRoleFrom.partyId"/>
         <set field="parameters.partyIdTo" from-field="orderRoleTo.partyId"/>