Migration script doesn't populate vtiger_pbxphonelookup correctly
Aside from the many other problems I have reported in the past with the migration scripts (see the dev mailling list), in 600_to_610.php around line 1272 the section which populates the vtiger_pbxmanagerlookup table is flawed.
There is an assumption that the only modules in vtiger which have phone fields are Contacts, Accounts and Leads. This ignores Vendors completely and also assumes that there are no additional modules which might contain phone numbers, such as vtlib created modules or simple new fields added to existing modules via the layout editor.
I suggest the the routine to generate the $modules array should be something more like this:
// get any module with a phone field excl PBXManager and Users.
$modules = array();
$getPhoneModulesQuery = "SELECT DISTINCT (vtiger_field.tabid), vtiger_tab.name
FROM vtiger_field
INNER JOIN vtiger_tab
ON vtiger_tab.tabid = vtiger_field.tabid
WHERE uitype = 11 AND vtiger_tab.name != 'PBXManager' AND vtiger_tab.name != 'Users'";
$getPhoneModulesQueryresult = $adb->query($getPhoneModulesQuery);
if($adb->num_rows($getPhoneModulesQueryresult)) {
while ($row = $adb->fetch_array($getPhoneModulesQueryresult)) {
$modules[] = $row['name'];
}
}
On a large database this is also incredibly slow. When you have several hundred thousand Contacts this routine will take many hours to run.