Upgrade-Safe way to hide subpanels

What he means is create a file, then add the contents quoted (but changed to your own modules/subpanels.)

Doddsy has just chosen a slightly odd wording is all, by saying to create a file (that is empty, which is true of almost all newly created files) and then to put the contents inside of it.

Oh good, because that’s what I did. Unfortunately, I’m still not getting anywhere on it.

“Odd wording” :slight_smile:

Lol, I was trying to speak plain English & clearly failing :slight_smile:

You won’t see the needed files in the Custom directory until you actially customize a module.

Just add a field in the module & then there will be a directory for that module with the right files under the “Custom” directory.

Hmm, not sure I’m following. I thought this just hid subpanels and didn’t have anything to do with adding fields.

From my understanding and I’m no expert.

Once a module hads been customised with “Studio” (adding a field usually), a number of files then appear in the “Custom” directory under a folder with that modules name.

That of course makes your changes upgrade proof, as the customisations are kept separate from the core files.

If you have no need for an additional field, then just don’t display it in any layout.

But that will trigger the creation of the files to work with in the Custom Directory.

Aha, I get you now. Unfortunately, the ones I have left are Activities and History, which actually don’t appear as subpanels but I guess are somehow autogenerated in the Project module.

So, I went a totally different route, went into suitecrm/modules/Project/metadata and edited subpaneldefs.php. I just commented out the lines for the subpanels I didn’t want and blammo. I have no idea if this was a good idea, but it worked.

What you did is completely upgrade UNsafe. You modified the files that will be overwritten upon any upgrade. You need to change all your files in the suitecrm/custom directory.

Put your changes into suitecrm/custom/modules/Project/metadata/subpaneldefs.php
Restore the original suitecrm/modules/Project/metadata/subpaneldefs.php

Quick Repair and Rebuild.

I know that, but using the safe method just straight up didn’t work, especially with Activities and History (which don’t count as actual subpanels). Also, suitecrm/custom/modules/Project/metadata/subpaneldefs.php doesn’t exist. I’ve tried going through Ext/Layoutdefs but to no avail.

I’m a little surprised that you guys are talking about the metadata folder, as I’ve never used it.

I would have thought the fodler is /custom/Extension/modules/project/Ext/Layoutdefs

My custom module is in /custom/Extension/modules/CER_ClientEquipment/Ext/Layoutdefs

And of course the act of building a custom module creates all of the files except the “custom.php” which is the one I made (from information on this post, definitely didn’t think of it myself B) B) ). It’s only the permanent modules that you have to customize in studio to create the module folder in the “Custom” directory. (My apologies if that caused confusion earlier). Custom modules should already be there.

Good luck with your changes & it’s not that much work to modify your file again after upgrades. I’m glad you got it working.

Just to reduce confusion for the next person, a photo of my directory structure with the custom.php file is attached.

I love GUI’s :whistle:

Does this method still work ?

in folder


/var/www/html/suitecrm/custom/modules/Accounts/Ext/Layoutdefs

I have 2 files


-rwxrwxrwx 1 www-data www-data 401 Jan 16 12:25 custom.php
-rwxr-xr-x 1 www-data www-data 575 Jan 16 12:25 layoutdefs.ext.php

layoutdefs.ext.php


<?php
 //WARNING: The contents of this file are auto-generated


//auto-generated file DO NOT EDIT
$layout_defs['Accounts']['subpanel_setup']['contacts']['override_subpanel_name'] = 'Account_subpanel_contacts';


//auto-generated file DO NOT EDIT
$layout_defs['Accounts']['subpanel_setup']['account_aos_contracts']['override_subpanel_name'] = 'Account_subpanel_account_aos_contracts';


//auto-generated file DO NOT EDIT
$layout_defs['Accounts']['subpanel_setup']['products_services_purchased']['override_subpanel_name'] = 'Account_subpanel_products_services_purchased';

?>

custom.php


<?php
 // Remove activities & tasks from Accounts module (Ian Dodds)
unset($layout_defs['Accounts']['subpanel_setup']['activities']);
unset($layout_defs['Accounts']['subpanel_setup']['tasks']);
unset($layout_defs['Accounts']['subpanel_setup']['history']);
unset($layout_defs['Accounts']['subpanel_setup']['leads']);
unset($layout_defs['Accounts']['subpanel_setup']['products_services_purchased']);
?>

when I run a “Quick Repair and Rebuild” I dont see the subpanels being removed. I also wanted to mention I renamed Accounts module to Organizations.

Any help would be appreciated

Does this method still work ?

in folder


/var/www/html/suitecrm/custom/modules/Accounts/Ext/Layoutdefs

I have 2 files


-rwxrwxrwx 1 www-data www-data 401 Jan 16 12:25 custom.php
-rwxr-xr-x 1 www-data www-data 575 Jan 16 12:25 layoutdefs.ext.php

layoutdefs.ext.php


<?php
 //WARNING: The contents of this file are auto-generated


//auto-generated file DO NOT EDIT
$layout_defs['Accounts']['subpanel_setup']['contacts']['override_subpanel_name'] = 'Account_subpanel_contacts';


//auto-generated file DO NOT EDIT
$layout_defs['Accounts']['subpanel_setup']['account_aos_contracts']['override_subpanel_name'] = 'Account_subpanel_account_aos_contracts';


//auto-generated file DO NOT EDIT
$layout_defs['Accounts']['subpanel_setup']['products_services_purchased']['override_subpanel_name'] = 'Account_subpanel_products_services_purchased';

?>

custom.php


<?php
 // Remove activities & tasks from Accounts module (Ian Dodds)
unset($layout_defs['Accounts']['subpanel_setup']['activities']);
unset($layout_defs['Accounts']['subpanel_setup']['tasks']);
unset($layout_defs['Accounts']['subpanel_setup']['history']);
unset($layout_defs['Accounts']['subpanel_setup']['leads']);
unset($layout_defs['Accounts']['subpanel_setup']['products_services_purchased']);
?>

when I run a “Quick Repair and Rebuild” I dont see the subpanels being removed. I also wanted to mention I renamed Accounts module to Organizations.

Any help would be appreciated

You are looking in

/var/www/html/suitecrm/custom/modules/Accounts/Ext/Layoutdefs

These files are overwritten upon a Rebuild/Repair.

Look at changing files in

/var/www/html/suitecrm/custom/Extension/modules/Accounts/Ext/Layoutdefs

The naming convention setup makes it a bit confusing. The “Ext” directory gets rebuilt from everything in the “custom/Extension” directory.

1 Like

In version 7.10.5 what I did was just comment, //, in …/modules/Accounts/metadata/subpaneldefs.php:

//‘products_services_purchased’ => array(
// ‘order’ => 104,
//‘module’ => ‘AOS_Products_Quotes’,
//‘subpanel_name’ => ‘ForAccounts’,
//‘get_subpanel_data’ => ‘function//:getProductsServicesPurchasedQuery’,
//‘title_key’ => ‘LBL_PRODUCTS_SERVICES_PURCHASED_SUBPANEL_TITLE’,
//),

It worked, before and after Repair and Rebuild

I don’t understand why I do this in custom/modules/Accounts/metadata/subpaneldefs.php it does not work

You can try to Unset the Subpanel by its name by creating a file at

custom/Extension/modules/<MODULE_NAME>/Ext/Layoutdefs/unset_subpanels.php

In this file you will unset the subpanels for the module, so forexample is i want to Hide documents subpanel in Accounts. i will have the content

unset($layout_defs[‘Accounts’][‘subpanel_setup’][‘documents’]);

Thanks you, cherub-chum,

I need to add custom module to Activities subpanel top button, so I edit custom/module/Accounts/metadata/subpaneldefs.php, but it does not work, I edit in module/Accounts/metadata/subpaneldefs.php that it work