[
http://mifosforge.jira.com/browse/MIFOS-2687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=56771#action_56771
]
Udai Gupta commented on MIFOS-2687:
-----------------------------------
After some testing I found that Money#toString and currencyRoundingOffMultiple
(uses digitAfterdecimal) are working as expected. i.e they will not add .0 if
DigitAfterDecimal=0
Money#getAmountDoubleValue() is being used in main code to satisfy some legacy
code where the calculation are being done on double values.
System.out.println(new BigDecimal("10").setScale(13,
RoundingMode.HALF_UP).doubleValue());
or
System.out.println(new BigDecimal("10").doubleValue());
will always output as 10.0 (preceding one zero)
There 151 references (385 if you include tests) to this method itself and I
guess there will be some "on the spot" Money -> double conversions too.
In ideal case we should not have doubles for calculation, Money->BigDecimal
should be used instead of double. (may be this is our chance to fix it)
Reverting back to the previous validation (which mean to hack it to allow this
condition) is an ugly solution, but It will be a quick fix.
> Hotfix 1.4.3 - Mifos is prepopulating loan and fee amounts with a decimal
> even though the digitsAfterDecimal is set to 0 and this is now throwing errors
> --------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: MIFOS-2687
> URL: http://mifosforge.jira.com/browse/MIFOS-2687
> Project: mifos
> Issue Type: Bug
> Affects Versions: Release 1.4.2
> Reporter: rwhitney
> Assignee: mifosdeveloperqueue
> Priority: Major
> Fix For: Release 1.4.3
>
>
> This was working fine previously in Mifos 1.3.1 and surfaced in 1.4.2.
> When creating a loan, if the configuration setting
> AccountingRules.DigitsAfterDecimal is set to 0, Mifos still populates the
> loan amount and fee amount with a single decimal place. This means that when
> attempting to continue the loan application, mifos throws the two following
> errors
> # The Amount is invalid because the number of digits after the decimal
> separator exceeds the allowed number 0
> # The administrative fee is invalid because the number of digits after the
> decimal separator exceeds the allowed number 0
> REPRO:
> Configure Mifos instance with AccountingRules.DigitsAfterDecimal=0
> 1. Create Loan product with a fee attached
> 2. Create a loan account for a client
> 3. Note that for the loan amount, it has added .0 (ie, 5000 = 5000.0) and the
> fee has an added .0 as well (20 = 20.0)
> 4. Click on continue
> EXPECTED:
> Mifos does not throw an error and goes to the next page
> ACTUAL:
> Mifos throws the two errors
> There are two options for this solution
> 1. Rollback to the original functionality, where it did not trigger the
> error, since .0 is still accurate, in regards to the rounding
> 2. Fix Mifos to not add the .0, which would be closer to what was implied in
> the configuration setting
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://mifosforge.jira.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Mifos-issues mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mifos-issues