HOWTO: Disable vCard import and export

sugarcrmdevelopers —  August 5, 2011 — 4 Comments

For every person derived module ( Contacts, for example ) has the ability to import and export vCards with ease. If for some reason you don’t want to be able to do this, it’s a very simple exercise.

To disable importing vCards, you just need to remove the ‘Create from vCard’ link in the menu, which just requires you to copy the Menu.php file from it’s location in your module to the custom/YOURMODULE/ directory and then comment out the vCard menu entry. Here’s what it would look like for the Contacts module for example:

global $mod_strings, $app_strings, $sugar_config;

// Reset module menu
$module_menu = array();

if(ACLController::checkAccess('Contacts', 'edit', true)) $module_menu[] = Array("index.php?module=Contacts&action=EditView&return_module=Contacts&return_action=index", $mod_strings['LNK_NEW_CONTACT'],"CreateContacts", 'Contacts');
// Comment out vCard import line
//if(ACLController::checkAccess('Contacts', 'import', true)) $module_menu[] = Array("index.php?module=Contacts&action=ImportVCard", $mod_strings['LNK_IMPORT_VCARD'],"CreateContacts", 'Contacts');
if(ACLController::checkAccess('Contacts', 'list', true)) $module_menu[] = Array("index.php?module=Contacts&action=index&return_module=Contacts&return_action=DetailView", $mod_strings['LNK_CONTACT_LIST'],"Contacts", 'Contacts');

if(empty($sugar_config['disc_client'])) {
if(ACLController::checkAccess('Contacts', 'list', true)) $module_menu[] =Array("index.php?module=Reports&action=index&view=contacts", $mod_strings['LNK_CONTACT_REPORTS'],"ContactReports", 'Contacts');
if(ACLController::checkAccess('Contacts', 'import', true))$module_menu[] =Array("index.php?module=Import&action=Step1&import_module=Contacts&return_module=Contacts&return_action=index", $mod_strings['LNK_IMPORT_CONTACTS'],"Import", 'Contacts');

To disable the vCard download feature, you can just add the following attribute to the ‘full_name’ field in the vardefs.php for the module. The easiest way to do this is to add it to a new file named custom/Extension/modules/YOURMODULENAME/Vardefs/vCardDisable.php. Here’s what it should look like.

$dictionary[$module]['fields']['full_name']['customCode'] = '{$fields.full_name.value}';

You’ll need to do a ‘Quick Repair and Rebuild’ to make this active, but then you should no longer have any vCard options in your module.

4 responses to HOWTO: Disable vCard import and export


    The trick about moving Menu.php to custom/YOURMODULE/directory is not upgrade-safe, is it?  If an upgrade came along Menu.php would probably re-appear in its original location breaking the customisation, no?


      This is upgrade-safe, since anything in the custom/ directory overrides what’s in the original location. Also, we don’t change anything in the custom directory without your permission.


        Ah that is nice.  So if I wanted to, say disable a built-in dashlet (e.g. My Accounts), I could put empty files in the custom directory with the same name as the ones in the /module directory and it would override and remove the dashlet? 


    for vcard download feature its not working

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s