You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2013/12/04 02:48:16 UTC

svn commit: r1547673 - in /ofbiz/trunk: ./ applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml

Author: adrianc
Date: Wed Dec  4 01:48:16 2013
New Revision: 1547673

URL: http://svn.apache.org/r1547673
Log:
Merged revision(s) 1547657 from ofbiz/branches/release13.07:
Fixed some flawed conditional logic introduced in rev 1488656.

Modified:
    ofbiz/trunk/   (props changed)
    ofbiz/trunk/applications/accounting/script/org/ofbiz/accounting/payment/PaymentServices.xml

Propchange: ofbiz/trunk/
------------------------------------------------------------------------------
  Merged /ofbiz/branches/release13.07:r1547657

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=1547673&r1=1547672&r2=1547673&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 Dec  4 01:48:16 2013
@@ -982,31 +982,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"/>