tags:

views:

1611

answers:

2

We use a customized installation of SugarCRM and I need to make a change to the "Convert Lead to Contact" form. On the form, only "last name" is marked as required, but if the user does not enter a salutation or first name, Sugar will throw an SQL error on the insert (because salutation and first name are required fields for contacts).

I've tried adding this line to "modules/Contacts/metadata/editviewdefs.php" and "modules/Contacts/metadata/quickcreatedefs.php":

array (
'name' => 'first_name',
'displayParams'=>array('required'=>true),
)

I'm trying other modifications but I can't find anything online yet on this exact problem. I will update this question with my findings. Thanks!

Update: Added "first_name" and "salutation" to the 'required_fields' array in "modules/Contacts/field_arrays.php", did not help.

Update: This is on SugarCRM 5.1. This work is happening during the upgrade to 5.1.

Update: Added the following line to "modules/Contacts/vardefs.php" the "email_and_name1" array, did not help.

'required' => 'true',
A: 

I appear to have figured out a solution. I created an upgrade file in "custom/Extension/modules/Contacts/Ext/Vardefs" called "custom.php". The contents of the file are below:

<?php
$dictionary['Contact']['fields']['salutation']['required'] = true;
$dictionary['Contact']['fields']['first_name']['required'] = true;
?>

After I did a "quick repair and rebuild", the salutation and first name were now required. This works for me.

Ed Schwehm
+1  A: 

The above didn't work for me. I am using 5.2.0.

What worked for me was to edit custom/modules/{modulename}/metadata/editviewdefs.php and add:

'name' => 'first_name', 'displayParams' => array ( 'required' => true, ),

Then quick repair/rebuild.