Results 1 to 10 of 10

Thread: Unified Search/Vardefs - where to put code

  1. #1
    mikesolomon is offline Sugar Community Member
    Join Date
    Feb 2008
    Location
    UK
    Posts
    1,467

    Default Unified Search/Vardefs - where to put code

    I want to add the Accounts field ticker_symbol to the unified search

    I can make it work by adding the following to the dictionary section of modules/Accounts/vardefs.php

    'ticker_symbol' =>
    array (
    'name' => 'ticker_symbol',
    'vname' => 'LBL_TICKER_SYMBOL',
    'unified_search' => true,
    'type' => 'varchar',
    'len' => 10,
    'comment' => 'The stock trading (ticker) symbol for the account',
    ),

    The problem with this is it regularly gets overwritten

    I tried putting the following in custom/Extension/modules/Accounts/Ext/Vardefs/vardefs.php

    $dictionary['Account']['fields']['ticker_symbol'] = array (
    'name' => 'ticker_symbol',
    'vname' => 'LBL_TICKER_SYMBOL',
    'unified_search' => true,
    'type' => 'varchar',
    'len' => 10,
    'comment' => 'The stock trading (ticker) symbol for the account',
    );

    but that didn't work

    I could also put it in include/SugarObjects/templates/company/vardefs.php

    Where is the best place to modify it so it won't be overwritten?

  2. #2
    dpatech is offline Sugar Community Member
    Join Date
    Oct 2007
    Location
    NC
    Posts
    287

    Default Re: Unified Search/Vardefs - where to put code

    custom/Extension/modules/Accounts/Ext/Vardefs/vardefs.php is the correct place to put this, but you have to be sure to then use Admin -> Repair -> Rebuild Extensions followed by Admin -> Repair -> Clear Vardefs Data Cache (with only clear vardefs checked).

    Did you already do those steps?
    - Sugar Team
    dpa Technology LLC
    e-mail: dpaDeveloper@dpatechnology.com
    web: http://www.dpatechnology.com

  3. #3
    mikesolomon is offline Sugar Community Member
    Join Date
    Feb 2008
    Location
    UK
    Posts
    1,467

    Default Re: Unified Search/Vardefs - where to put code

    Quote Originally Posted by dpatech
    custom/Extension/modules/Accounts/Ext/Vardefs/vardefs.php is the correct place to put this, but you have to be sure to then use Admin -> Repair -> Rebuild Extensions followed by Admin -> Repair -> Clear Vardefs Data Cache (with only clear vardefs checked).

    Did you already do those steps?
    yup - didnt work

    The other code I have in there does tho - very strange - I'll have to check my code

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

    Default Re: Unified Search/Vardefs - where to put code

    Here is how to create an upgrade safe modification to the vardefs. Create a new file called custom\Extension\modules\Accounts\Ext\Vardefs\cust om.php

    Put the following into the file:
    PHP Code:
    <?php
    $dictionary
    ['Account']['fields']['ticker_symbol']['unified_search'] =  true;
    ?>
    Now go to Admin->Rebuild->Quick Repair and Rebuild and click Repair.
    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

  5. #5
    mikesolomon is offline Sugar Community Member
    Join Date
    Feb 2008
    Location
    UK
    Posts
    1,467

    Default Re: Unified Search/Vardefs - where to put code

    Quote Originally Posted by clint
    Here is how to create an upgrade safe modification to the vardefs. Create a new file called custom\Extension\modules\Accounts\Ext\Vardefs\cust om.php

    Put the following into the file:
    PHP Code:
    <?php
    $dictionary
    ['Account']['fields']['ticker_symbol']['unified_search'] =  true;
    ?>
    Now go to Admin->Rebuild->Quick Repair and Rebuild and click Repair.
    That doesnt seem to work in this instance

    What appears to be happening is that gets overwritten by includes\SugarObjects\templates\company\vardefs.ph p

    What order do the various vardefs get looked at?

  6. #6
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Unified Search/Vardefs - where to put code

    Hi, Mike.

    The first read vardefs is the core vardefs module, after that the custom vardefs is read for updating the fields definitions.
    The clint and dpatech suggestion is implemented automatically by the module builder when you define an extended vardefs in a installer.

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  7. #7
    mikesolomon is offline Sugar Community Member
    Join Date
    Feb 2008
    Location
    UK
    Posts
    1,467

    Default Re: Unified Search/Vardefs - where to put code

    Quote Originally Posted by andopes
    Hi, Mike.

    The first read vardefs is the core vardefs module, after that the custom vardefs is read for updating the fields definitions.
    The clint and dpatech suggestion is implemented automatically by the module builder when you define an extended vardefs in a installer.

    Cheers
    For some reason the entry in includes\SugarObjects\templates\company\vardefs.ph p overwrites changes put in the custom

    It seems to be read last - I could of course be wrong

  8. #8
    mikesolomon is offline Sugar Community Member
    Join Date
    Feb 2008
    Location
    UK
    Posts
    1,467

    Default Re: Unified Search/Vardefs - where to put code

    logged as bug 24129
    Mike Solomon
    Development Manager
    Ivy Ltd
    www.ivy.ltd.uk]www.ivy.ltd.uk

    php version 5.2.6
    MySql 5.1.59

  9. #9
    majed's Avatar
    majed is offline Sugar Team Member
    Join Date
    Sep 2004
    Posts
    198

    Default Re: Unified Search/Vardefs - where to put code

    If you follow the steps listed by Clint it should work.There is one more step that you need to do though. That is clear the vardef cache using admin->repair->clear vardef cache.

    If you still have issues after that let me know. I just tested it on a 5.1 instance and it works fine.



    Thanks,
    Majed
    Majed Itani
    Software Engineer
    SugarCRM Inc.

  10. #10
    mikesolomon is offline Sugar Community Member
    Join Date
    Feb 2008
    Location
    UK
    Posts
    1,467

    Default Re: Unified Search/Vardefs - where to put code

    Quote Originally Posted by majed
    If you follow the steps listed by Clint it should work.There is one more step that you need to do though. That is clear the vardef cache using admin->repair->clear vardef cache.

    If you still have issues after that let me know. I just tested it on a 5.1 instance and it works fine.



    Thanks,
    Majed
    I have tried the method Clint suggested in 5.0.0.g and done a reapair in fact in my dev copy of sugar I even tried deleting the whole cache but it does not work for me


    What appears to be happening is that gets overwritten by includes\SugarObjects\templates\company\vardefs.ph p which includes the following

    Code:
    'ticker_symbol' => 
      array (
        'name' => 'ticker_symbol',
        'vname' => 'LBL_TICKER_SYMBOL',
        'type' => 'varchar',
        'len' => 10,
        'comment' => 'The stock trading (ticker) symbol for the company',
        'merge_filter' => 'enabled',
      ),
    Mike Solomon
    Development Manager
    Ivy Ltd
    www.ivy.ltd.uk]www.ivy.ltd.uk

    php version 5.2.6
    MySql 5.1.59

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Sugar Events - programing hooks
    By gasparz in forum Developer Help
    Replies: 8
    Last Post: 2011-08-24, 07:55 AM
  2. Where can i put this code?? :(
    By Spirouu in forum Developer Help
    Replies: 0
    Last Post: 2008-02-18, 03:24 PM
  3. Code to update an opportunity
    By stevec in forum Developer Help
    Replies: 0
    Last Post: 2007-04-24, 11:33 AM
  4. where is the html code that creates the pages in sugarcrm
    By santosh.ghalsasi in forum General Discussion
    Replies: 2
    Last Post: 2007-03-03, 07:20 AM
  5. Code contributions FAQ
    By andydreisch in forum General Discussion
    Replies: 0
    Last Post: 2006-11-15, 08:29 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
  •