Hide Contacts subpanel in Accounts module

Hi,

I want to hide Contacts Subpanel in Account module. i tried to add the following code under:

@custom\Extension\modules\Accounts\Ext\Layoutdefs\layoutdefs.ext.php

and also tried,

@custom\Extension\modules\Accounts\Ext\Layoutdefs\_overrideAccount_subpanel_accounts_contacts.php

The code:

unset($layout_defs['Accounts']['subpanel_setup']['accounts_contacts']);

But both location are not working to hide the contact subpanel.

  • Hello Jason,

         I have achieved this  but not in an upgrade safe manner. Until you get an upgrade safe to achieve this, you can follow below instructions.

         In following path:

              modules/Accounts/metadata/subpaneldefs.php

         Comment the code written for Contact module.

    e.g.

                'contacts' => array(

                    'order' => 30,

                    'module' => 'Contacts',

                    'sort_order' => 'asc',

                    'sort_by' => 'last_name, first_name',

                    'subpanel_name' => 'ForAccounts',

                    'get_subpanel_data' => 'contacts',

                    'add_subpanel_data' => 'contact_id',

                    'title_key' => 'LBL_CONTACTS_SUBPANEL_TITLE',

                    'top_buttons' => array(

                        array('widget_class' => 'SubPanelTopCreateAccountNameButton'),

                        array('widget_class' => 'SubPanelTopSelectButton', 'mode'=>'MultiSelect')

                    ),

                ),

        And then do a quick repair and rebuilt. Let me know if you still have the problem.

        *Always remember to take backup of directory or CRM before doing any kind of changes in core file

  • Hi Jason,,

    this is upgradesafe coding..

    Subpanel layouts are defined originally within metadata, e.g. /modules/Accounts/metadata/subpaneldefs.php.

    These files hold the original, default layout of subpanels and the fields within them. They are overridden in custom Extension data, e.g. custom/Extension/modules/Accounts/Ext/Layoutdefs/accounts_cont.php.

    After a repair & rebuild, you’ll find the data from the arbitrarily named files are merged and placed in /custom/modules/Accounts/Ext/Layoutdefs/layoutdefs.ext.php.

    <?php

    unset($layout_defs["Accounts"]["subpanel_setup"]['contacts']);

  • Hi Sohan & Mehul,

    The solutions are not working for me, but I found the solution: $layout_defs['Accounts']['subpanel_setup'][contacts] = array ();

    Thanks anyway!!

  • Hi jason ,

    Logically

    unset($layout_defs["Accounts"]["subpanel_setup"]['contacts']);

    and

    $layout_defs['Accounts']['subpanel_setup'][contacts] = array ();

    both are Same.

  • Hi Mehul,

    But, unset($layout_defs["Accounts"]["subpanel_setup"]['contacts']); is not working for me. Weird.

  • Hi Mehul,

    thanks for this upgradesafe coding tips. But I still can't hide my sub-panels.

    1) I have created a new file in <custom/Extension/modules/Accounts/Ext/Layoutdefs/accounts_cont.php>

    with following lines of code: unset($layout_defs["Accounts"]["subpanel_setup"]['contacts']);

    2) clicked repair & rebuild and I can find the changes in </custom/modules/Accounts/Ext/Layoutdefs/layoutdefs.ext.php>.

    --> But there are NO changes in the Accounts mask for end users.
    Thx for any help.

  • This solution works for me! Sugar (version 7.6.0.0)

     

    1) Copy file modules/accounts/clients/base/layouts/subpanels/subpanels.php to --> custom/modules/accounts/clients/base/layouts/subpanels/subpanels.php

    2) Open file custom/modules/accounts/clients/base/layouts/subpanels/subpanels.php in Editor.

    3) Hiding e.g. contacts: find 'link' => 'contacts' and comment the whole section

    /****

        array (

          'layout' => 'subpanel',

          'label' => 'LBL_CONTACTS_SUBPANEL_TITLE',

    'override_subpanel_list_view' => 'subpanel-for-accounts',

          'context' => array (

            'link' => 'contacts',

          ),

        ),

    ****/

    4) Save >> Quick repair and rebuild >> DONE