|
Eliminate Name Field Auto Modification for Addressbook Sorts |
|
|
|
|
Written by John Button
|
|
Monday, 11 August 2008 |
|
By default, the Turba component in Horde will "guess" the appropriate value of the Name field when displaying an address book listing. This is done by combining the first and last names then guessing the base part of the last name. Often this is incorrect and in my usage, annoying.
To eliminate this behavior, modify the code to use whatever is in the Name field directly without change. The file turba/lib/Turba.php contains the code. Locate near line 215 the guessLastName function. Then change to branch around the guessing logic as follows: if(false){ if (!empty($name)) { /* Assume that last names are always before any commas. */ if (is_int(strpos($name, ','))) { $name = String::substr($name, 0, strpos($name, ',')); } /* Take out anything in parentheses. */ $name = trim(preg_replace('|\(.*\)|', '', $name));
$namelist = explode(' ', $name); $name = $namelist[($nameindex = (count($namelist) - 1))]; while (!empty($name) && String::length($name) < 5 && strspn($name[(String::length($name) - 1)], '.:-') && !empty($namelist[($nameindex - 1)])) { $nameindex--; $name = $namelist[$nameindex]; } } } |
|
Last Updated ( Monday, 11 August 2008 )
|