I analyzed the logic for email address. There are several words before results of the analysis.
The object Lead has unconfirmed information about person and company. The information can be set as a rubbish and it can’t be converted to other object. If the information is correctly then the most of the information is describing person. We communicate with people which represent company. When we convert the Lead the first object is Contact. The logic included to object SugarEmailAddress
of SuiteCRM.
Now about add email in both objects Contact and Account.
- add
email1
into array of moduleAccounts
and removeemail1
from array of moduleContacts
in file modules/Leads/metadata/convertdefs.php - change the method
display
in the filemodules/Leads/views/view.convertlead.php
...
} elseif ($field == "id") {
//If it is not a contact, don't copy the ID from the lead
// if ($module == "Contacts") {
if ($module == "Contacts" || $module == "Accounts") {
$focus->$field = $this->focus->$field;
}
...
- change the function
getEmailAddressWidget
in the fileinclude/SugarEmailAddress/getEmailAddressWidget.php
...
if ($view == 'EditView' || $view == 'QuickCreate' || $view == 'ConvertLead') {
$module = $focus->module_dir;
// if ($view == 'ConvertLead' && $module == "Contacts") {
if ($view == 'ConvertLead' && ($module == "Contacts"|| module == "Accounts") ) {
$module = "Leads";
}
...
- change the method
getEmailAddressWidgetEditView
in the fileinclude/SugarEmailAddress/SugarEmailAddress.php
...
if (!empty($id)) {
$prefillDataArr = $this->getAddressesByGUID($id, $module);
//When coming from convert leads, sometimes module is Contacts while the id is for a lead.
// if (empty($prefillDataArr) && $module == "Contacts") {
if (empty($prefillDataArr) && ($module == "Contacts" || $module == "Accounts") ) {
$prefillDataArr = $this->getAddressesByGUID($id, "Leads");
}
...
After the manipualtions you will get one email address in both objects Contact and Account.
P.S. If you want to get email address in object Account only you should remove module Contacts
from the three conditions. This changing doesn’t support with upgrade.