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

Thread: Disable Format doesnt Disable Format

  1. #1
    DanBrown is offline Senior Member
    Join Date
    Jul 2008
    Posts
    95

    Question Disable Format doesnt Disable Format

    Im using version 5.0, and when i create a new field in a custom module and set it as an "integer" with "Disable Format" checked, i can still format it and enter my own number. I would like the field to assign its own number so every case has a unique number automatically, Am i missing something?

    Thanks.

  2. #2
    eNick is offline Sugar Community Member
    Join Date
    Apr 2008
    Location
    UK
    Posts
    282

    Default Re: Disable Format doesnt Disable Format

    No you need to set it to auto increment.

    See Mike Solomon's answer (near the bottom) in this thread...

    http://www.sugarcrm.com/forums/showt...auto+increment

    Alternately, just change the MySql column definition to Autoincrement.
    T H E S U G A R R E F I N E R Y
    : : : SugarCrm Customisation and Integration Services : : :

    SugarCRM Systems Integration Partner
    Trusted with SugarCRM
    http://www.theSugarRefinery.com ::: sales@{removethis}theSugarRefinery.com

  3. #3
    DanBrown is offline Senior Member
    Join Date
    Jul 2008
    Posts
    95

    Default Re: Disable Format doesnt Disable Format

    Thanks for the reply.
    As default the column is set to auto_increment, the problem seems to occur when i make a change to the fields layout and re deploy the module. Even after this the column is still set to auto_increment in the database, but a number can now be manually inputted into the number field.

    Thanks

  4. #4
    eNick is offline Sugar Community Member
    Join Date
    Apr 2008
    Location
    UK
    Posts
    282

    Default Re: Disable Format doesnt Disable Format

    To stop a number being manually input, use 'type'=>'readonly' in the editview.def.

    This is similar to the Case Number on Cases which is autogenerated and read only....

    array('name'=>'case_number', 'type'=>'readonly', 'displayParams'=>array('required'=>true))

    And yes, unfortunately, direct changes to the viewdefs are typically lost if you make further changes in studio/module builder.
    T H E S U G A R R E F I N E R Y
    : : : SugarCrm Customisation and Integration Services : : :

    SugarCRM Systems Integration Partner
    Trusted with SugarCRM
    http://www.theSugarRefinery.com ::: sales@{removethis}theSugarRefinery.com

  5. #5
    DanBrown is offline Senior Member
    Join Date
    Jul 2008
    Posts
    95

    Default Re: Disable Format doesnt Disable Format

    Thanks for the reply.
    Am i right in saying the best thing to do is configure the modules fully before deploying them and then leave them? Where can i locate this editview.def to change to read only.

    Thanks again
    Last edited by DanBrown; 2008-07-25 at 10:20 AM.

  6. #6
    eNick is offline Sugar Community Member
    Join Date
    Apr 2008
    Location
    UK
    Posts
    282

    Default Re: Disable Format doesnt Disable Format

    All I can say is that our approach is that when we are altering a file which is potentially going to be overwritten through either the studio or through a system upgrade (ie. if we're changing core code), we place a file in the same directory documenting the changes and usually set the file permissions to read only.


    So, if we hand edit an editviewdef.php we'll set it's permissions to read only and create a file called editviewdef.php.readme and document in there any changes we made. That way it can only be overwritten if someone changes the permissions and then they will (hopefully) read the documentation and re-apply the changes.

    And yes, we tend to make sure it's all correct before deploying - so our process is to do all the changes we can through the studio/module builder etc. and then once we're happy with those, to add in any changes which require hand edits and then deploy again.
    T H E S U G A R R E F I N E R Y
    : : : SugarCrm Customisation and Integration Services : : :

    SugarCRM Systems Integration Partner
    Trusted with SugarCRM
    http://www.theSugarRefinery.com ::: sales@{removethis}theSugarRefinery.com

  7. #7
    DanBrown is offline Senior Member
    Join Date
    Jul 2008
    Posts
    95

    Thumbs up Re: Disable Format doesnt Disable Format

    Thanks for your help ill give it a go.

  8. #8
    clint's Avatar
    clint is offline Sugar Team Member | Forums Lead Moderator
    Join Date
    Aug 2004
    Location
    Silicon Valley
    Posts
    2,120

    Default Re: Disable Format doesnt Disable Format

    The "disable format" option on a custom integer field removes the thousands separator for the display in the Detail View and List Views.
    Sugar Developer Zone - developer resources | Sugar University - user and admin training
    Sugar Docs - user and admin documentation |
    Sugar Bug Tracker - Enter or view bugs
    SugarForge- open source modules, themes, lang packs | SugarExchange - commercial extensions

    Clint Oram
    Chief Technology Officer and Co-founder
    SugarCRM

  9. #9
    DanBrown is offline Senior Member
    Join Date
    Jul 2008
    Posts
    95

    Question Re: Disable Format doesnt Disable Format

    I am still getting an issue where i cannot 'blank out' the unique number field. It is crucial that this area is automatically assigning issue numbers as users will assign which ever number they like. Iv tried looking for specific editviewdef.php files and cannot.

    Please bear in mind im new to sugar and php so i dont understand much of your code...

    Many Thanks

  10. #10
    eNick is offline Sugar Community Member
    Join Date
    Apr 2008
    Location
    UK
    Posts
    282

    Default Re: Disable Format doesnt Disable Format

    Ok, so to summarise where we are:


    Disable format has nothing to do with your problem. It's purpose is to stop Sugar formatting your number. So if you enter 123456 disabling the formatting prevents it being displayed as 123,456 (with a comma).

    So, that leaves two issues:

    1) Making it autoincrement, which it sounds like you've done.
    2) Making the field read only so people can't change it.

    To make a field read only you need to make a change in the editviewdefs file.

    That will be located in...

    custom/modules/<your module name>/metadata/editviewdefs.php

    Inside this file you'll see an entry similar to this...

    array('name'=>'<your field name>', 'type'=>'<something - probably integer>', 'displayParams'=>array('required'=>true))

    And you need to change type to 'readonly'

    That will (or should!) prevent it being editable. You'll probably need to do a Repair to rebuild the cached file after the change. And if you deploy your package again it may get overwritten.
    T H E S U G A R R E F I N E R Y
    : : : SugarCrm Customisation and Integration Services : : :

    SugarCRM Systems Integration Partner
    Trusted with SugarCRM
    http://www.theSugarRefinery.com ::: sales@{removethis}theSugarRefinery.com

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. Adding format for SSN and EIN
    By ptemplin7 in forum Feature Requests
    Replies: 0
    Last Post: 2007-06-28, 07:38 PM
  2. Problem with date format
    By Binotto in forum Help
    Replies: 2
    Last Post: 2007-05-14, 07:17 AM
  3. Wrong date format in $this?
    By leenwebb in forum Developer Help
    Replies: 5
    Last Post: 2007-02-06, 08:41 PM
  4. Date Format Anguish in 4.2.1b
    By Venners in forum Help
    Replies: 0
    Last Post: 2006-08-03, 08:24 PM
  5. Problem with Date format
    By nicolas in forum Help
    Replies: 1
    Last Post: 2005-05-19, 02:16 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
  •