Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-319

Money custom fields? values get rounded to six-digit numbers


    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 1.1
    • Fix Version/s: 1.1
    • Component/s: None
    • Labels:


      1. Create a Money/Text field.
      2. Go to a contact and try to input various numbers into the field.

      The numbers make their way into database alright, but on display (and edit) the default MySQL setting is to round them to at most six significant digits:

      0.001234567 to 0.00123457
      1.234567 to 1.23457
      123.4567 to 123.457
      123456.7 to 123457
      1234567 to 1.23457e+06

      The use of floats for monetary type is generally a no-no in computer design (mosty due to the fact how floats are represented internally). The sanest thing in our kind of application is to assume that there shouldn?t be a currency with smaller-than 1/100th of the base value (i.e., there are cents, but no parts of cents), and keep the value multiplied by 100 in an integer field (perhaps a bigint, as there might be countries where 1000000 of the base currency is a waitress? tip). We generally shouldn?t allow the users to insert 23.456 (or round it internally to 23.46).

      At the very least, for 1.1 we have to change the way the numbers are rendered.




            • Assignee:
              lobo Donald A. Lobo
              shot Piotr Szotkowski
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created: