vt7: Please can we fix this at some stage (User Module Entityname fields)?
We have several customers who asked us to change the way the Assigned User is displayed in vtiger. This should be achievable by a simple change to the fieldname column of the vtiger_entityname table.
For our customers they wanted to see the username, rather than the combination of first_name + last_name.
This line of code appears in several places in vtiger:
$userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
Which makes the assumption that the Assigned User will ALWAYS be shown as first_name + last_name.
It causes us a lot of headaches to have to change quite a few core vtiger files to be able to accommodate their requirement.
We have to replace the above code with this (I put it in a static function) which does not care how many, or what, fields are specified in the fieldname column of the vtiger_entityname table:
$entityFields = Vtiger_Functions::getEntityModuleInfoFieldsFormatted('Users');
if(count($entityFields['fieldname']) > 1) {
$columns = array();
foreach($entityFields['fieldname'] as $i => $fieldname) {
$columns[$fieldname] = $entityFields['tablename'] . '.' . $fieldname;
}
$userNameSql = getSqlForNameInDisplayFormat($columns, 'Users');
} else {
$userNameSql = $entityFields['tablename'] . '.' . $entityFields['fieldname'];
}
It would be lovely to see this addressed in a future release :-)