I added some custom fields to the editview of my employees module. I then synchronized these to detailview. This lost the nice little âgrouped addressâ display. I tried to restore, but alas, the default doesnât seem to be saved and is the same as what I have on the screen now.
Iâm sure there is a manual way to fix this⌠Iâm hoping someone can tell me how. I donât see any tables in the database that are likely to be the cause or place where this is stored⌠and when I looked at the file structure, based on date modified, I didnât find the file that I need to replace with the default installation file.
Under public_html/custom/modules/Employees/metadata there is a file that was edited in the right time frame, but alas, there is no corresponding file in the source files from SuiteCRM-7.1.3 MAX⌠furthermore, if I rename that file (editviewdefs.php) to (editviewdefs.php.old) it has zero effect.
Any help is appreciated. This was easy enough to screw up, I canât imagine Iâm the first to do this.
Just delete the custom editviewdefs file and it will restore back to the default layout for that module. There is no way to get back custom layout changes that have been lost.
Awesome Andy! It was actually detailviewdefs.php in my case, but this worked great. In case future folks are reading this trying to do the same thing, in my case the applicable file was located atâŚ
/public_html/custom/modules/Employees/metadata
I simply renamed detailviewdefs.php to OLD9_16_2014detailviewdefs.php and then did a âQuick Repair and Rebuildâ and the edit view was unchanged but the detail view (on refresh) was back to its old definition!!!
I did lose a couple of changes in the detail view, but they are easy enough to restore.
Interestingly⌠when I added my two fields to Employees->DetailView, the âAddressâ field shows up in detailview as âAddress Countryâ (and only shows the country) instead of showing the entire concatenated address.
To be clear, Iâm trying to leave âAddressâ alone/default⌠and trying to add Employee Start Date and End Date as new fields. What the fields are isnât relevant, but I wanted to be clear it wasnât having anything to do with the address.
In Studio it still shows up as âAddressâ, so it seems to me this is a bug. Not sure if anyone has ideas.
This is getting to be outside the domain of the subject line âRestore Detailview Manuallyâ⌠but since it is a continuationâŚ
When I add items to contacts or accounts modules in studio, the address is not broken.
When I look at the detailviewdefs.php file for each of those, I can see how it works there, but the difference is, in both of those cases there is a âkeyâ associated with the address in questions (primary, alt, billing, shipping)⌠and when I try and steal the code from their detailviewdefs.php, I havenât been able to find anything to put in the âkeyâ for the âdisplayParamsâ to make the correct data show up in the view state.
Here is the relevant information from the viewdefs for the contact:
OK, I found this code in /public_html/modules/Employees/metadata/detailviewdefs.php⌠and copied and pasted it into detailviewdefs.php in /custom/modules/Employees/metadata/detailviewdefs.php and it worked!
Although I did have to do a âQuick Repair and Rebuildâ⌠and Iâm certain this change will be lost whenever I make additional changes in studio to the employees module.
If you ever remove a field from view that has customCode and save the layout, it will not be put back by itself if you re-add the field to view definition.
When you remove a field from the view you are removing the field from the defs file, if you re-add the field to the view the code for the field is added to the file its not going to magically re-add customisations to that code.
I agree with you Andy. I suggested it just because it MAY contain something useful.
I want to emphasize that it is not structured in any way and, as you say, rather old. But if you have time to browse it rapidly, given the lack of documentation, one could find some useful examples.
Iâve found that the best way to make custom changes to your viewdef files outside of studio is to do it in the view class itself before parent::display()
Hereâs some custom code I use in my CustomContactsViewDetail to put an image into my detail view (the findPhoto function just finds a file in the /upload/photo that has the file name _$params[2] and returns a thumbnail image inside an anchor tag to the full image ) and magnific-popup is a LightBox module. This way, no matter what I do in the studio, the photo still loads in the view. The only issue is if you need to change the index of the entry but thatâs just changing [0][1] to something else.