Results 1 to 2 of 2

Thread: Unable to assign Sub Category to document; 25 character limit

  1. #1
    dantrainor is offline Sugar Community Member
    Join Date
    Oct 2007
    Posts
    47

    Default Unable to assign Sub Category to document; 25 character limit

    Hi -

    I'm trying to trace down a peculiar problem.

    I'm playing with the uploading of documents, and as you may know, there's a Sub Category option. I have one category in particular that, when a document is assigned to it, the bean fails to save that associated information - its blank.

    There are several other Sub Categories in that list, which ahve been added via Dropdown Editor, and a quick spot check shows that they all work fine as well. Its just this one particular Sub Category which I can't seem to assign any documents to.

    At first guess I thought I hit a field length limit, as the Item Name and Display Name are each exactly 32 characters long. After making a similar entry exactly 31 characters long, this data is still not saved. I went down the list, until I reached 24 characters, and it worked. It appears that there is a 24 character limit on this field.

    Sure enough, in the database, I see 25 character varchars:

    | category_id | varchar(25) | YES | MUL | NULL | |
    | subcategory_id | varchar(25) | YES | | NULL | |
    | status_id | varchar(25) | YES | | NULL | |

    Has anyone else experienced this? How about a possible workaround? I'd like to say this is an easy fix by simply changing the database schema but based on past experiences I'm kind of scared to do this.

    Thanks!
    -dant

  2. #2
    datasponge is offline Sugar Community Member
    Join Date
    Mar 2008
    Location
    San Jose, CA, USA
    Posts
    553

    Default Re: Unable to assign Sub Category to document; 25 character limit

    You can create a vardef extension to redefine the field so it is longer. Then when you do a repair, it will resync vardefs with the database and ask you if you want to run an alter table query that updates the table definition. This way the Sugar definition is in sync with the database.

    If you just change it in the database, then it will be out of sync and Sugar will want to run an alter table query every time you repair vardefs.

    Basically create a file custom/Extension/modules/Documents/Ext/Vardefs/custom.php and add the single line that redefines the field length in the array. The current array definition is in the file modules/Documents/vardefs.php, so you reset that array element explicitly and change the 25 to something bigger. The name of the file doesn't matter and you can create the folders if needed.

    Then do a Quick Repair from admin and run the query when prompted.

    Phil

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How to modify document category?
    By yukos in forum Help
    Replies: 2
    Last Post: 2009-01-29, 05:51 PM
  2. How do I add a document category?
    By adders in forum Help
    Replies: 7
    Last Post: 2006-10-31, 10:32 AM
  3. Setting Document Category to none
    By andreasw in forum Help
    Replies: 2
    Last Post: 2006-07-30, 01:22 PM
  4. Replies: 2
    Last Post: 2006-05-05, 09:10 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
  •