Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Bug? Detailview value doesn't match entered value.

  1. #1
    knptrsn is offline Sugar Community Member
    Join Date
    Jan 2008
    Posts
    13

    Default Bug? Detailview value doesn't match entered value.

    If I enter 189,000 in a custom currency field, it shows up as 189 in the detailview panel. It appears the application is dividing by 1000.
    I've repaired, cleared all caches, removed the field from view, repaired, viewed then added it back only to have the same bogus data.
    Any ideas for how to fix this?

    This is a custom field in the account module.
    Sugar Version 5.0.0b (Build 3150)

  2. #2
    kbrill's Avatar
    kbrill is offline SugarCRM PS Engineer
    Join Date
    Jul 2004
    Location
    St Louis, MO
    Posts
    3,183

    Default Re: Bug? Detailview value doesn't match entered value.

    I have reported this to engineering as bug #20010. I will post a hot fix if I can get one.
    Kenneth Brill - Help Forum Moderator

    I do not respond to 'Private Messages'. Please email me directly instead

    When asking for help, PLEASE give us your Server Information and Version Numbers as asked for on the 'Post New Message' screen as well as any JavaScript errors shown at the bottom of the browser window.
    Help us Help You

  3. #3
    knptrsn is offline Sugar Community Member
    Join Date
    Jan 2008
    Posts
    13

    Default Re: Bug? Detailview value doesn't match entered value.

    Thank you kindly. Is there someway to be proactively notified, or how does one go about monitoring when that fix is released?

  4. #4
    kbrill's Avatar
    kbrill is offline SugarCRM PS Engineer
    Join Date
    Jul 2004
    Location
    St Louis, MO
    Posts
    3,183

    Default Re: Bug? Detailview value doesn't match entered value.

    I put your member name down as the contact for the bug, you should get emails about it when the status changes.
    Kenneth Brill - Help Forum Moderator

    I do not respond to 'Private Messages'. Please email me directly instead

    When asking for help, PLEASE give us your Server Information and Version Numbers as asked for on the 'Post New Message' screen as well as any JavaScript errors shown at the bottom of the browser window.
    Help us Help You

  5. #5
    knptrsn is offline Sugar Community Member
    Join Date
    Jan 2008
    Posts
    13

    Default Re: Bug? Detailview value doesn't match entered value.

    Right on. Thank you.

  6. #6
    pizzazz916 is offline Junior Member
    Join Date
    Jun 2007
    Posts
    1

    Default Re: Bug? Detailview value doesn't match entered value.

    Currently using:
    Version 5.0.0b (Build 3150)

    Yes, I have just experienced the same problem.
    The field type is Currency. If i, for example, go to Accounts edit view
    and edit an account, type in 1285, it returns a value of "1.0" when i go to the detail view.

    Am I doing something wrong or is there a patch for this?
    You help would be greatly appreciated.

    D

  7. #7
    ToniFatec is offline Sugar Community Member
    Join Date
    Feb 2008
    Posts
    64

    Default Re: Bug? Detailview value doesn't match entered value.

    The problem also occurs when creating a float field (Decimal in Studio). It sounds like the format_number SugarBean metodo that acts in Accounts DetailView is incorrect or is called more then once.

  8. #8
    Nisbet is offline Sugar Community Member
    Join Date
    Aug 2007
    Posts
    42

    Default Re: Bug? Detailview value doesn't match entered value.

    I am also running into this issue with integer fields , but only with custom fields in stock modules(i,e Accounts). Integer fields in custom modules seem to behave properly.

    Hope that helps some


    Version 5.0.0b (Build 3150) Open Source version
    Apache/Mysql/Linux

  9. #9
    ToniFatec is offline Sugar Community Member
    Join Date
    Feb 2008
    Posts
    64

    Default Re: Bug? Detailview value doesn't match entered value.

    I've putted I quick workaround to this in: http://www.sugarcrm.com/forums/showp...5&postcount=13

  10. #10
    bnortmann is offline Junior Member
    Join Date
    May 2008
    Location
    Germany
    Posts
    1

    Cool Re: Bug? Detailview value doesn't match entered value.

    I encountered the same problem using SugarCRM CE 5.0.0e. Values entered (or already present) in custom decimal / float fields got altered in strange ways upon saving. E.g. 0.45 turned to 45.00, 12.3 became 123.00, and a tax quote of 25.00 percent would end up as 2,500.00. So I had to dive into the PHP code to nail down this problem...

    For this issue to occur it seem's you have to a) use custom floating point fields and b) change the number separators, so the thousands separator is '.' - this is common in Europe in conjunction with ',' for the decimal separator. The problem arises because values entered get parsed / converted twice. The second alteration is wrong and leads to incorrect data stored in the database fields - to me this clearly looks like a bug in SugarCRM.

    Values entered first get processed within the save() function of data/SugarBean.php (line #1140). The function uses
    PHP Code:
    $this->unformat_all_fields(); 
    which in turn calls unformat_number. Numeric input ends up in 'ANSI C' format this way - say e.g. "16,0" entered in 'European format' will end up as "16.0". However, examining the code that follows reveals that custom fields get treated as special, since they handle their save seperately. Line #1330 calls the save() function of modules/DynamicFields/DynamicField.php (declared at line #214) to achieve this.

    But - lo and behold - guess what this function does with the value that unformat_all_fields has worked on?
    PHP Code:
    if($field['type'] == 'int' || $field['type']== 'float'){
       if (!empty(
    $this->bean->$name)) {
          
    $this->bean->$name unTranslateNum($this->bean->$name);
       } 
    It uses unTranslateNum() on numeric fields and thus causes havoc. Looking at unTranslateNum() (declared in include/utils.php at line #1477) quickly reveals that this function again tries to convert the decimal separator and strips the thousands separator from the input string. Given this is '.', the already processed "16.0" turns to "160" - which is clearly not the intended value to be stored in the database.

    My (quick and dirty) workaround for this problem is a simple 'sanity check' to see if unformat_all_fields already worked on the fields - since the function sets an appropriate flag for the bean. So changing the above part of DynamicField.php to
    PHP Code:
    if($field['type'] == 'int' || $field['type']== 'float'){
       if (!
    $this->bean->unformated_numbers) {
          if (!empty(
    $this->bean->$name)) {
             
    $this->bean->$name unTranslateNum($this->bean->$name);
          }
       } 
    did the job for me.

    Hope this helps.

    Regards, bnortmann

    [EDIT] typos...
    Last edited by bnortmann; 2008-05-26 at 09:02 PM.

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. empty bug number in notification mail
    By fabianfritzer in forum Developer Help
    Replies: 1
    Last Post: 2007-12-05, 02:17 AM
  2. Replies: 4
    Last Post: 2006-07-19, 03:10 PM
  3. Bug submitting a bug
    By sunside in forum Help
    Replies: 3
    Last Post: 2006-05-06, 12:01 AM
  4. Bug in Integer Field
    By ejc in forum Help
    Replies: 0
    Last Post: 2005-11-24, 03:45 AM

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
  •