When it comes to developing solutions for SugarCRM there are many different ways to go about solving a particular challenge. In our Dev Tips series of blogs we will be highlighting various best practices for add-on development with the end goal of creating higher quality solutions while minimizing the chances of an end user experiencing an issue.
One way to create solutions for SugarCRM is by creating installable packages called modules. Modules contain all the required files along with a manifest.php which defines how the module should be installed. Here are a couple of links which help define and provide examples of a manifest:
SugarCRM Support: Creating an Installable Package for a Logic Hook
Most of the possible options within a manifest are fairly safe as most use the Extension framework to guarantee that there will not be conflicts with other modules that are installed. However, the option that is used in near every module but doesn’t utilize the Extension framework is the copy array option. The copy array defines what files and/or directories from the module zip should be copied over and to where it should be copied to. There is good reason for copy being unique from the Extension framework, but because of how it is used to copy over both files and directories, care must be taken to prevent accidental or unneeded removal of existing customizations.
More importantly, the copy array should accurately list the customizations that are being copied into an install as it is useful for users to be able to open and see if anything being copied over will overwrite a customization of their own. With SugarOutfitters we do that scanning for users and present them a list of the files that may have a chance of conflicting with their own customizations (whether they be from another module, studio, or hand coded). Here are the items that we flag along with some suggestions on how to improve that manifest entry:
Blank Copy to Root
Example:
'copy' => array ( | |
array ( | |
'from' => '<basepath>/files/', | |
'to' => '', | |
), | |
), |
'copy' => array ( | |
array ( | |
'from' => '<basepath>/files/modules/MyAwesomeModule', | |
'to' => 'modules/MyAwesomeModule', | |
), | |
), |
Full Directory Copy
Example:
'copy' => array ( | |
array ( | |
'from' => '<basepath>/files/custom/modules/Accounts', | |
'to' => 'custom/modules/Accounts', | |
), | |
), |
'copy' => array ( | |
array ( | |
'from' => '<basepath>/files/custom/modules/Accounts/EmailAccount.php', | |
'to' => 'custom/modules/Accounts/EmailAccount.php', | |
), | |
array ( | |
'from' => '<basepath>/files/custom/modules/Accounts/metadata/detailviewdefs.php', | |
'to' => 'custom/modules/Accounts/metadata/detailviewdefs.php', | |
), | |
), |
Core File Copy
Example:
'copy' => array ( | |
array ( | |
'from' => '<basepath>/files/modules/Accounts/metadata/detailviewdefs.php', | |
'to' => 'modules/Accounts/metadata/detailviewdefs.php', | |
), | |
), |
'copy' => array ( | |
array ( | |
'from' => '<basepath>/files/custom/modules/Accounts/metadata/detailviewdefs.php' | |
'to' => 'custom/modules/metadata/detailviewdefs.php', | |
), | |
), |
Custom File Copy
Example:
'copy' => array ( | |
array ( | |
'from' => '<basepath>/files/custom/modules/Accounts/views/view.edit.php', | |
'to' => 'custom/modules/Accounts/views/view.edit.php', | |
), | |
), |
With the above suggestions, members will be well-informed about and feel more comfortable with what they’re getting into when purchasing your custom modules. This gives a much better chance for a good user experience when installing and using the module as the user will know what to expect. Furthermore, with SugarOutfitters, we can better present accurate conflict notifications including possible conflicts with other previously purchased add-ons.
So when it comes to the copy directive option, be as descriptive as possible. It will save both users and yourself some headaches.
-
OpportunitiesAlerts
Stay on top of your open opportunities and improve your sales conversion rate. Delivered right to your inbox, you will always be equipped with the latest list of opportunities on hand. -
Data Anonymizer for SugarCRM
Is data privacy your priority? Get a data-breach proof CRM system! Data Anonymizer is a tool designed to quickly encode data on your CRM instance, while preserving their diversity and relations betwee... -
Integration & Migration powered by StarfishETL
FEATUREDConnect your data and automate more efficiently using this powerful low code iPaaS. Integrate to pull the necessary data you need into Sugar and migrate to get your platform up and running easier and ... - Show more addons