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

Thread: remove subpanels from Accounts module

  1. #1
    wica is offline Sugar Community Member
    Join Date
    Jan 2008
    Location
    Vilnius, Lithuania
    Posts
    11

    Default remove subpanels from Accounts module

    Hey there,

    I'm using Sugar 5.0.0b and have a problem with removing subpanels from Accounts module. I've tried 2 ways to do this:
    1. To comment/delete unnecessary lines in modules\Accounts\metdata\subpaneldefs.php.
    2. To add code lines to modules\Accounts\vardefs.php
    <?php
    unset($layout_defs['Accounts']['subpanel_setup']['leads']);
    ?>

    These works perfectly on other modules, however, when i made these changes to Accounts, I get the error message:
    Notice: Undefined index: leads in D:\www\sugarcrm\include\SubPanel\SubPanelDefinitio ns.php on line 406

    Warning: aSubPanel::require(modules//metadata/subpanels/.php) [function.aSubPanel-require]: failed to open stream: No such file or directory in D:\www\sugarcrm\include\SubPanel\SubPanelDefinitio ns.php on line 84

    Fatal error: aSubPanel::require() [function.require]: Failed opening required 'modules//metadata/subpanels/.php' (include_path='D:\www\sugarcrm\include/..;.;C:\php5\pear') in D:\www\sugarcrm\include\SubPanel\SubPanelDefinitio ns.php on line 84

    I've read all possibly related threads, but didn't get any working solution. Could someone help?



  2. #2
    DragonflyMaster is offline Sugar Community Member
    Join Date
    Dec 2007
    Location
    Rimini, Italy
    Posts
    1,421

    Default Re: remove subpanels from Accounts module

    Hi wica,

    try the following:
    Go in Admin-> Configure Group Tabs and remove all occurences of Leads module.
    Then open <sugar-root>\modules\Accounts\metadata\subpaneldefs.php and comment out all of this:
    Code:
    'leads' => array(
    'order' => 50,
    'module' => 'Leads',
    'sort_order' => 'asc',
    'sort_by' => 'last_name, first_name',
    'subpanel_name' => 'default',
    'get_subpanel_data' => 'leads',
    'add_subpanel_data' => 'lead_id',
    'title_key' => 'LBL_LEADS_SUBPANEL_TITLE',
    'top_buttons' => array(
    array('widget_class' => 'SubPanelTopCreateLeadNameButton'),
    array('widget_class' => 'SubPanelTopSelectButton',
    'popup_module' => 'Opportunities',
    'mode' => 'MultiSelect', 
    ),
    ),
    ),
    Also, be sure there is no custom version of this file in <sugar-root>\custom\modules\Accounts\metadata.
    At the end you might need to delete template cache and rebuild relationships.
    What do you think the cookie monster eats ?

  3. #3
    wica is offline Sugar Community Member
    Join Date
    Jan 2008
    Location
    Vilnius, Lithuania
    Posts
    11

    Default Re: remove subpanels from Accounts module

    Thanks for your quick reply!

    I've just tried to make your suggested changes, unfortunately it didn't work. I receive the same error messages



  4. #4
    DragonflyMaster is offline Sugar Community Member
    Join Date
    Dec 2007
    Location
    Rimini, Italy
    Posts
    1,421

    Default Re: remove subpanels from Accounts module

    Quote Originally Posted by wica
    Thanks for your quick reply!

    I've just tried to make your suggested changes, unfortunately it didn't work. I receive the same error messages


    I don't know what else to think...
    Are you sure you hadn't previously modified something?
    Try deleting/renaming cache folder, so that all templates and stuff are rebuilt correctly.
    Note that deleting cache folder often results in loss of some functionality, that's why I suggest to rename it and eventually delete the new one and restore the renamed one.
    What do you think the cookie monster eats ?

  5. #5
    wica is offline Sugar Community Member
    Join Date
    Jan 2008
    Location
    Vilnius, Lithuania
    Posts
    11

    Default Re: remove subpanels from Accounts module

    After renaming cache folder the same result appears...
    But you know, it's the strange issue - i have working with 2 Sugar's: one installed on server and other on my PC (for testing works, in case not to broke smth), they're totally different now. And the thing is, that the same problem on both of them: i can remove sub panel on every module except Accounts. Maybe it's smth different/wrong with Account module sub panels development?


  6. #6
    DragonflyMaster is offline Sugar Community Member
    Join Date
    Dec 2007
    Location
    Rimini, Italy
    Posts
    1,421

    Default Re: remove subpanels from Accounts module

    Quote Originally Posted by wica
    After renaming cache folder the same result appears...
    But you know, it's the strange issue - i have working with 2 Sugar's: one installed on server and other on my PC (for testing works, in case not to broke smth), they're totally different now. And the thing is, that the same problem on both of them: i can remove sub panel on every module except Accounts. Maybe it's smth different/wrong with Account module sub panels development?

    Under this aspect, accounts module is like every other module.
    I would install Sugar again on your pc and try again.
    What do you think the cookie monster eats ?

  7. #7
    gregwatson is offline Sugar Community Member
    Join Date
    Sep 2007
    Posts
    20

    Lightbulb Re: remove subpanels from Accounts module

    Wica,

    I was getting the same error message in the Contacts module when trying the unset($layout_defs[etc...] technique. After a little digging around, I discovered that the problem was only happening with one particular user. When I switched to another user, there was no error and the subpanel I had unset was not there.

    After looking through the code, I discovered the problem for the one user was a user preference (stored in the user_preferences table) with an array containing a list of subpanels for the contacts module. This user preference gets written whenever you change the order of the subpanels by dragging and dropping them. One of the subpanels stored in this array was the one I had unset.

    When Sugar displays the view, before it renders the subpanels it checks to see if the user has a 'custom' subpanel order set in their user preferences. If so it tries to display the subpanels in that custom order. The problem I was running into is that the custom order included the subpanel I had 'unset' and Sugar was failing to display the subpanel since it no longer had any properties.

    In my case I solved the problem by deleting that preference record from the user_preferences table. After that, it worked fine. To do this, you will need to know the user_id for your current user and the category name of the preference. You can find the category name by putting this debugging line after line 98 in the file modules/UserPreferences/UserPreference.php:
    PHP Code:
    if ($name == 'subpanelLayout') print "<span style='background-color:yellow'>User preference category is: $category</style>"
    A better way to avoid this problem would be to check whether a subpanel is actually defined in $layout_defs before trying to render it. This example seems to work for me. Keep in mind that I haven't tested it much and it isn't an upgrade-safe change. Add the following at line 229 of include/SubPanel/SubPanelTiles.php:
    PHP Code:
    //Skip to the next subpanel if this one is not defined
    if ($this->subpanel_definitions->layout_defs['subpanel_setup'][$tab] == NULL) continue; 
    The end result of this change is that Sugar will just skip over that subpanel if it isn't defined, rather than trying to display it and failing.

    --Greg Watson

  8. #8
    gregwatson is offline Sugar Community Member
    Join Date
    Sep 2007
    Posts
    20

    Default Re: remove subpanels from Accounts module

    I forgot to mention, if you delete the preference record from the user_preferences table you need to log out and log back in again to reset the display.

    --Greg

  9. #9
    DragonflyMaster is offline Sugar Community Member
    Join Date
    Dec 2007
    Location
    Rimini, Italy
    Posts
    1,421

    Default Re: remove subpanels from Accounts module

    Quote Originally Posted by gregwatson
    Wica,

    I was getting the same error message in the Contacts module when trying the unset($layout_defs[etc...] technique. After a little digging around, I discovered that the problem was only happening with one particular user. When I switched to another user, there was no error and the subpanel I had unset was not there.

    After looking through the code, I discovered the problem for the one user was a user preference (stored in the user_preferences table) with an array containing a list of subpanels for the contacts module. This user preference gets written whenever you change the order of the subpanels by dragging and dropping them. One of the subpanels stored in this array was the one I had unset.

    When Sugar displays the view, before it renders the subpanels it checks to see if the user has a 'custom' subpanel order set in their user preferences. If so it tries to display the subpanels in that custom order. The problem I was running into is that the custom order included the subpanel I had 'unset' and Sugar was failing to display the subpanel since it no longer had any properties.

    In my case I solved the problem by deleting that preference record from the user_preferences table. After that, it worked fine. To do this, you will need to know the user_id for your current user and the category name of the preference. You can find the category name by putting this debugging line after line 98 in the file modules/UserPreferences/UserPreference.php:
    PHP Code:
    if ($name == 'subpanelLayout') print "<span style='background-color:yellow'>User preference category is: $category</style>"
    A better way to avoid this problem would be to check whether a subpanel is actually defined in $layout_defs before trying to render it. This example seems to work for me. Keep in mind that I haven't tested it much and it isn't an upgrade-safe change. Add the following at line 229 of include/SubPanel/SubPanelTiles.php:
    PHP Code:
     //Skip to the next subpanel if this one is not defined
     
    if ($this->subpanel_definitions->layout_defs['subpanel_setup'][$tab] == NULL) continue; 
    The end result of this change is that Sugar will just skip over that subpanel if it isn't defined, rather than trying to display it and failing.

    --Greg Watson
    The same should be possible via Admin->Repair Roles.
    What do you think the cookie monster eats ?

  10. #10
    gregwatson is offline Sugar Community Member
    Join Date
    Sep 2007
    Posts
    20

    Default Re: remove subpanels from Accounts module

    Quote Originally Posted by DragonflyMaster
    The same should be possible via Admin->Repair Roles.
    In my case Repair Roles doesn't seem to fix the error. Or am I misunderstanding?

    --Greg

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. Manually Remove Module
    By fbnewtz in forum Help
    Replies: 6
    Last Post: 2010-03-26, 05:25 PM
  2. HOWTO - Enhance ModuleBuilder generated modules to include AJAX
    By kenneth.thorman in forum Developer Tutorials
    Replies: 10
    Last Post: 2009-01-16, 05:53 PM
  3. Lost Subpanels, Lost Contact List
    By ptemplin7 in forum Help
    Replies: 1
    Last Post: 2008-03-01, 05:54 AM
  4. Studio edits to accounts module not showing live ?
    By webdesignhelper in forum Help
    Replies: 2
    Last Post: 2008-02-18, 04:04 PM
  5. MODULE: Subpanels Revamp!
    By mrmilk in forum Downloads
    Replies: 57
    Last Post: 2007-06-08, 11:34 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
  •