Results 1 to 4 of 4

Thread: Decimal Precision (detailview.php)

  1. #1
    Iggby's Avatar
    Iggby is offline Sugar Community Member
    Join Date
    Feb 2008
    Location
    Huntingtonton Beach, Ca
    Posts
    101

    Default Decimal Precision (detailview.php)

    I have several custom field in the opportunity module. The decimal precision was set at 3 when the fields were created with studio. The database had a precision of 3 verified by phpMyAdmin. When view the record however the output is being displayed (rounded off) to 2 decimal places. For instance 1.125 is entered on the edit screen and 1.125 shows up in the database, but when displayed with detail view it is displayed as 1.13

    A review of the detailviewdefs.php file doesn't immediately seem to have any precision settings. Can someone offer advice as to why Sugar is rounding this off and suggest where I need to look to fix this.

    Thanks.

  2. #2
    ptemplin7 is offline Sugar Community Member
    Join Date
    Jun 2007
    Location
    Puget Sound Washington
    Posts
    380

    Default Re: Decimal Precision (detailview.php)

    Check your setting for users in the admin pages. My guess is it is set to 2 decimal precision. You might be able to force it by changing the php code as well. Make sure the field is NOT set to type currency.

    Next time put this in the help forum. You will get an answer faster.

    Good luck,
    Paris

  3. #3
    SohodojoJim is offline Sugar Community Member
    Join Date
    Apr 2005
    Location
    Fairfield, Iowa USA
    Posts
    29

    Default Re: Decimal Precision (detailview.php)

    I see how decimal precision for currency can be affected by the settings of the Admin section, but the issue I am having under the 5.x release is that a custom field of decimal type with a precision of 4 behaves like this:

    • On initial edit and save, the number entered at precision is stored in the database as expected.

    • If the user does any subsequent edit, the edit view will round the custom field to 2 decimal places precision. Then if the record is saved, the database is updated with the rounded entry for the custom field in question.


    It is not at all clear if/how to tweak this edit/display view configuration so as to avoid this problem. I would expect that this is a Studio-editable issue rather than a code-editing problem. It _may_, however, be a subtle gotcha with the initial release of the version 5 codebase. (My prior experience is with the 3.x-4.x versions some time ago, so this is my first dive into the new and as-always nicely improved source.)

    ADDITIONAL INFORMATION: If I change the Currency Significant Digits to 4 for a user via the user management of Admin, the display and edit precision for ALL numerical fields is affected rather than just the currency fields. As a work around at the moment, I figure I will increase this value for each user and let them see extra decimal places for currency fields until I come up with a better/prettier solution and/or the next point release fixes this issue.
    Last edited by SohodojoJim; 2008-03-19 at 06:34 PM.

  4. #4
    Iggby's Avatar
    Iggby is offline Sugar Community Member
    Join Date
    Feb 2008
    Location
    Huntingtonton Beach, Ca
    Posts
    101

    Default Re: Decimal Precision (detailview.php)

    I will check into this. I don't recall the decimal places ever being correct i the display, however after review of the database the number is correct. This is extremely important to me because the numbers being entered cannot be rounded in any way. Also they are not currency but rather percentages.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Decimal precision and currency
    By Iggby in forum General Discussion
    Replies: 6
    Last Post: 2009-12-16, 08:34 PM
  2. Replies: 4
    Last Post: 2007-12-10, 04:49 PM
  3. Replies: 0
    Last Post: 2006-06-01, 03:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •