You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Scott Gray (JIRA)" <ji...@apache.org> on 2009/09/10 07:20:57 UTC
[jira] Closed: (OFBIZ-2833) Receive offline payment (May be the
Entity Engine) has decimal precision problem
[ https://issues.apache.org/jira/browse/OFBIZ-2833?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Scott Gray closed OFBIZ-2833.
-----------------------------
Resolution: Fixed
Fix Version/s: SVN trunk
Assignee: Scott Gray
Using ObjectType.simpleTypeConvert seems to fix the issue, committed in r813232. Thanks for the detailed report Miles.
> Receive offline payment (May be the Entity Engine) has decimal precision problem
> --------------------------------------------------------------------------------
>
> Key: OFBIZ-2833
> URL: https://issues.apache.org/jira/browse/OFBIZ-2833
> Project: OFBiz
> Issue Type: Bug
> Components: framework, order
> Affects Versions: Release Branch 9.04, SVN trunk
> Environment: The Database I'm used for testing is the built in Derby. I'm not sure if other DBMS has same problem.
> Reporter: Miles Huang
> Assignee: Scott Gray
> Fix For: SVN trunk
>
>
> Reproduce the problem is simple. In Order Manager Application, simply enter an offline payment for a sales order with amount $65.30, the payment amount stored in the DB will change to $65.29.
> Digging into the code, in the org.ofbiz.order.OrderManagerEvents.receiveOfflinePayment method, although the passed in amountStr is "65.30", the parsed out BigDecimal paymentTypeAmount have value "65.2999999999999971578290569595992565155029296875". Checking the payment amount stored in the Payments entity use web tools, the result is 65.29. And the order still has $0.01 outstanding amount.
> Parse the BigDecimal value from string directly may solve the problem partially. But imagine if someone enters $65.299, the problem is still there.
> Or a better and safe solution, in Entity Engine, always round half up BigDecimal value to the same precision as the corresponding DB column before insert/update?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.