Skip to content

Bug in the migration code 701_to_710.php

See the routine used to move the tag field from the custom table to the main table.

	//START::Tag fields are pointed to cf table for the modules Assets, Services etc..
	$fieldName = 'tags';
	$moduleModels = Vtiger_Module_Model::getAll();
	foreach ($moduleModels as $moduleModel) {
		$baseTableId = $moduleModel->basetableid;
		if ($baseTableId) {
			$baseTableName = $moduleModel->basetable;
			$customTableName = $baseTableName.'cf';

For most modules this is fine. BUT there are plenty where customTableName != baseTableName.'cf';

Potentials: vtiger_potential and vtiger_potentials.cf (note the "s")
Contacts: vtiger_contactdetails and vtiger_contactscf
Accounts: vtiger_account and vtiger_accountscf

I could go on. There are quite a few.

This code should probably use the $customFieldTable var in the core module class file, e.g. Accounts.php rather than trying to just make it up ;-)