Upgrade-Safe way to hide subpanels

Hi Bart,

Did you receive portal access details? If so, please create a case. If not, please let me know.

I will back to you on your questions asap.

Thanks,

Will.

Hello

I don’t understand. I made 2 tickets in the portal, but there the ticket is closed without solution.

Bart

How can I remove existing relations in modules eg . Accounts ? I want to remove the relation between accounts and documents do I can hide the documents subpanel on account detail… (since documents are only related to a custom module in my case). There is no delete button in the studio…
Same case for bugs (which I log on a custom module instead of on an account)

Really want to clean up ‘overhead’ in screens…

mikebruns99

looks like your copy/paste failed there.

unset($layout_defs);
unset($layout_defs);

Dear Andy,

the solution that you provided seems to be exactly the solution to the problem I have. Unfortunately I don’t get it. :unsure:

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

I want to remove the “Member Organizations” subpanel from the detailed Account view.
So how would I have to change your code to do so?
Or, the other way arroiund, what sub panel do you remove from what module, with the code that you’ve shown?
As ist says Accounts and accounts, I do not understand what the module’s name is and what the name of the sub panel.

I don’t want to remove any relationships, I only want to ged rid of some sub panels in some views, that can not be removed using studio.

Looking forward to hearing from you. - Thank you very much! :slight_smile:

Dear quarki69

I am not sure if you ever got this resolved but it is quite simple. I am using SuiteCRM 7.2.5 Beta

If you want to change the Sub panels in the Accounts View then you need to do the work here as this allows you to manipulate the Layout Definitions for the Accounts view

custom/Extension/modules/Accounts/Ext/Layoutdefs/myAccountsLayoutdefs.php

(you should create any of those subdirectories if they don’t exist yet)

Go all the way to the bottom of the file (then it is easy to find in future)

Step 1: Add a comment so you remember what you did

//Hide Subpanel view Leads & member Organizations

Step 2: Add the following 2 lines

unset($layout_defs['Accounts']['subpanel_setup']['leads']);
unset($layout_defs['Accounts']['subpanel_setup']['accounts']);

Step 3: Upload the folder back into the same spot

Step 4: Run “Repair and Rebuild” - which is in Admin->Repair

To understand the code is easy

unset($layout_defs['Accounts']['subpanel_setup']['accounts']); 
  • it is saying "Hide, in Acoounts, the Subpanel called leads

The next question you may have is how do I find the names of the subpanels I want to hide. That is also not hard go to

modules/Accounts/metadata/subpaneldefs.php and here you can spot the Subpanel name.

You can use the above logic for any Subpanel

7 Likes

Thanks a lot!!! I also did that.

unset($layout_defs['Contacts']['subpanel_setup']['contact_aos_quotes']);
unset($layout_defs['Contacts']['subpanel_setup']['contact_aos_invoices']);

this will unset the quotes and invoices on the contact module

Sorry to ask this in someone elses thread but it’s closely related.

Should this work with custom modules?

I have a custom module with subpanels but $layout_defs is an empty array, inside the metadata/subpanels folder for the module there is only default.php which I guess is the problem.

Right this works perfectly, until I find that certain modules don’t seem to have a layoutdefs such as the Calls module.

We don’t use ‘Leads’ at all, so going around unsetting it through each module and hiding it from nav menu display.

Unless it’s something like it’s not truly a module and the layout is defined elsewhere?

I can’t believe how long it took me to “get” this. :frowning: DCPaus is of course exactly right, but I wasn’t relating to it very well.

I wanted to hide the “activities, tasks & history” subpanels in the Accounts module.

None the less, for myself & the next person in step by step fashion.

Create a new (empty) file named custom.php in the /custom/Extension/modules/Accounts/Ext/Layoutdefs folder in your suitecrm directory.

The contents of the file are …

<?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']);
?>

Then do a “Quick Repair & Rebuild” from the repair selection in “Admin”

Following that, I also applied it to a custom module. (Copied the above custom.php file into the below directory & then edited the module name in the lines of code to suit.)

In my case the folder is /custom/Extension/modules/CER_ClientEquipment/Ext/Layoutdefs

(I opened one of the other files in this folder to get an accurate module name & copied that to replace the module name “Accounts” in the above example to my custom module name CER_ClientEquipment.)

The new code for my custom.php file is …

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

And then another “Quick Repair & Rebuild” from the repair selection in “Admin”

It worked as hoped in both scenario’s. I no longer see any of those 3 standard subpanels in either the Accounts module or my custom Client Equipment module.

SuitecRM Version 7.7.5

Gotta love computers :S :S :S

2 Likes

I’m trying to follow the original steps in the Project modules but the file does not exist. Additionally, there is no LayoutDefs in Accounts, just Vardefs. Did something change and does anyone know to what?

Secondly, I also tried Doddsy’s method, with no change. Admittedly I’m not quite sure what you mean by an “empty” file with contents in it.

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.