Ticket #6502 (new enhancement)

Opened 7 months ago

[patch] Warn if account name already exists when converting a lead

Reported by: delboy711 Assigned to: developer
Priority: unassigned Milestone: Unassigned
Component: vtigercrm Version: 5.1.0
Keywords: Cc:

Description

One problem users report is that they do not know if a Company name already exists when they convert a Lead.

We sell to individuals so the company name is normally set to the surname and initial of the individual which works fine until you try to convert a lead where that surname and initial already exists as an account in which case a new contact and potential gets added to the existing account.

This patch will check if the Companyname in a lead already exists in the Account database and will put a warning message in the convert popup.

In file modules/Leads/ConvertLead.php around line 170

                      		<select name="assigned_group_id" class="detailedViewTextBox">'.get_select_options_with_id(get_group_array(false,"Active", $userid,$private),$userid).'</select>
						</span>
						</td>
				</tr>';
// Check if Company name already exists in an account_name
$query = 'SELECT accountname from vtiger_account where accountname=?';
$res = $adb->pquery($query,array($company));
$rows = $adb->num_rows($res);

if($rows>0) {
				$convertlead .=  '<span style="color: red; font-size: 1.5em; font-weight: bold;">Warning. Account of same name already exists </span>';
}
//// End of company name check

			if(vtlib_isModuleActive('Accounts') && (isPermitted('Accounts','EditView')== 'yes')){
				$convertlead .= '<tr>