You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Jacques Le Roux (JIRA)" <ji...@apache.org> on 2017/03/10 11:25:04 UTC
[jira] [Commented] (OFBIZ-6386) compareBigDecimals in
org.ofbiz.minilang.method.conditional.Compare does not compare certain
values correctly
[ https://issues.apache.org/jira/browse/OFBIZ-6386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15904929#comment-15904929 ]
Jacques Le Roux commented on OFBIZ-6386:
----------------------------------------
This is due to expressions like this
{code}
<set field="totalPayableDebitAmount" value="${payableDebitTotal + 36.43}" type="BigDecimal"/>
{code}
This kind of changes fixes it (local BigDecimal)
{code}
Index: applications/accounting/script/org/ofbiz/accounting/test/AutoInvoiceTests.xml
===================================================================
--- applications/accounting/script/org/ofbiz/accounting/test/AutoInvoiceTests.xml (revision 1786324)
+++ applications/accounting/script/org/ofbiz/accounting/test/AutoInvoiceTests.xml (working copy)
@@ -295,9 +295,11 @@
<first-from-list list="paymentGroupMemberAndTransList" entry="paymentGroupMemberAndTrans"/>
<if-compare field="paymentGroupMemberAndTrans.finAccountTransStatusId" operator="not-equals" value="FINACT_TRNS_APPROVED">
- <set field="totalPayableDebitAmount" value="${payableDebitTotal + 82.86}" type="BigDecimal"/>
- <set field="totalPayableCreditAmount" value="${payableCreditTotal + 165.72}" type="BigDecimal"/>
- <set field="totalPayableDebitCreditDifference" value="${payableDebitCreditDifference - 82.86}" type="BigDecimal"/>
+ <set field="tempBig1" value="82.86" type="BigDecimal"/>
+ <set field="totalPayableDebitAmount" value="${payableDebitTotal + tempBig1}" type="BigDecimal"/>
+ <set field="totalPayableCreditAmount" value="165.72" type="BigDecimal"/>
+ <set field="totalPayableCreditAmount" value="${payableCreditTotal + totalPayableCreditAmount}" type="BigDecimal"/>
+ <set field="totalPayableDebitCreditDifference" value="${payableDebitCreditDifference - tempBig1}" type="BigDecimal"/>
<set field="getAcctgTransEntriesAndTransTotalMap.glAccountId" value="210000"/>
<call-service service-name="getAcctgTransEntriesAndTransTotal" in-map-name="getAcctgTransEntriesAndTransTotalMap">
<result-to-field result-name="debitTotal" field="payableDebitTotal"/>
@@ -311,8 +313,8 @@
<if-compare-field field="totalPayableDebitCreditDifference" operator="equals" to-field="payableDebitCreditDifference" type="BigDecimal"/>
</assert>
<check-errors/>
- <set field="totalUndepositedDebitAmount" value="${undepositedDebitTotal + 82.86}" type="BigDecimal"/>
- <set field="totalUndepositedDebitCreditDifference" value="${undepositedDebitCreditDifference + 82.86}" type="BigDecimal"/>
+ <set field="totalUndepositedDebitAmount" value="${undepositedDebitTotal + tempBig1}" type="BigDecimal"/>
+ <set field="totalUndepositedDebitCreditDifference" value="${undepositedDebitCreditDifference + tempBig1}" type="BigDecimal"/>
<set field="getAcctgTransEntriesAndTransTotalMap.glAccountId" value="111100"/>
<call-service service-name="getAcctgTransEntriesAndTransTotal" in-map-name="getAcctgTransEntriesAndTransTotalMap">
<result-to-field result-name="debitTotal" field="undepositedDebitTotal"/>
{code}
I'll commit a fix soon
> compareBigDecimals in org.ofbiz.minilang.method.conditional.Compare does not compare certain values correctly
> -------------------------------------------------------------------------------------------------------------
>
> Key: OFBIZ-6386
> URL: https://issues.apache.org/jira/browse/OFBIZ-6386
> Project: OFBiz
> Issue Type: Bug
> Affects Versions: Trunk
> Reporter: Gareth Carter
> Assignee: Jacques Le Roux
> Priority: Minor
> Fix For: Release Branch 15.12, Upcoming Release, 16.11.02
>
> Attachments: compareBigDecimals.png, OFBIZ-6386_1783753.patch, v1.patch, v2.patch
>
>
> Moving the conversation from OFBIZ-6291 to this issue.
> compareBigDecimals scales down and rounds up meaning you lose information and the comparison result is not as expected
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)