Custom detailviewdefs.php being overwritten?

SuiteCRM 7.9.5
Hosted by SalesAgility

Hi, I have a custom/modules/Accounts/metadata/detailviewdefs.php file that has a custom section within the buttons array that adds functionality to the Accounts -> Actions menu. My problem is that if I make changes in Studio to the Accounts Detail view, i.e. add another field to the view, move/rearrange the fields it appears to OVERWRITE the custom entries in the buttons array???

Is this the default behaviour? I would have thought those changes would be written to the panels array in the detailviewdefs.php file and the rest of the file left alone? If someone could enlighten me as to where/how changes to a modules detail view are written to the custom folder, it would be greatly appreciated

Thanks for your time and patience

I believe that when Studio touches a file, it touches the entire file, not part of it. Not entirely sure, though.

I’m not sure what the correct solution is, but you can make your file so that it just sets the parts you want of the array. Then see if you can get a way for SuiteCRM to pick it up; this depends on what customization it is, sometimes SuiteCRM scans the entire folder and grabs anything, sometimes it just picks a file with a known name. I don’t know enough about this to say, I just try different things.

Other than that, I would just stop using Studio on files I have customized with code. You can still use Studio if it’s convenient, of course, but then you’ll have to do some copy-pasting to put everything back in place.

Hey PGR, thanks for taking the time to post your thoughts, much appreciated

I have just completed the following:

  • Installed a local version of Suite 7.8.7
  • Apache 2.4.27. PHP 5.6.31, MySQL 5.7.19
  • Added my custom code to the custom/modules/Accounts/metadata/detailviewdefs.php file
  • Ran an Admin -> Repair -> QRR
  • Checked an Account record -> Actions menu for the presence of my custom menu entries. Entries were there and functioning as expected
  • Opened Studio -> Accounts -> Layouts -> DetailView, rearranged the order of a number of fields, removed one field. Saved and Deployed
  • Ran an Admin -> Repair -> QRR
  • Checked the Account record I had previously. Changes I had implemented via Studio (moved fields, deleted field) had propagated successfully AND my custom Action Menu entries were STILL there and functioning as expected

I think I will test it again using the same version of Suite that is present on the Sales Agility servers, however, this appears to show that using Studio to rearrange fields/delete fields on the DetailView does NOT by default overwrite the entire file, and is, from memory the way that SugarCRM worked, albeit the Professional version not Community…

OK, tested with Suite 7.9.5, PHP 7.0.23 and the problem is there. Added the code to my custom/modules/Accounts/metadata/detailviewdefs.php file and as soon as I made changes to the Accounts -> DetailView using Studio, it OVERWROTE the changes in the buttons array.

Will test with later versions to see if that behaviour has been changed…

Tested with 7.10 and the behaviour is the same as v 7.8.7 (GOOD, the entire file is NOT overwritten) which seems to say that the default behaviour when making changes with Studio is to LEAVE the buttons array alone, and that it DOES NOT overwrite the entire file… Obviously I’ve only tested with 2 versions, but now the version on Sales Agility seems to be the anomaly?

Does anyone know if a patch was released?

I don’t know how to explain your findings… have you tried searching GitHub Issues for anything related? (Remember to search also closed Issues).

You might like to learn this technique that really helps understand what Studio is doing:

https://pgorod.github.io/Audit-File-Accesses/

Hey PGR, great idea - might give it a go and will search the GitHub archives as suggested… I had used the Sysinternals Suite ages ago - from memory some of the applications can be used on a ‘stand-alone’ basis, don’t require installation…

Cheers