Modifying fields in the Turba addressbook
David | January 9, 2010I have recently started using the Funambol iPhone app to keep my contacts in sync with my webmail addressbook. However, some fields aren’t included in Turba by default and need adding. This post is for system administrators rather than users, so if you don’t run your own webmail then point your friendly geek at this post.
Firstly make sure you are using a recent version of Horde (e.g. 3.3.6). There are three easy steps to adding the fields you would like in Turba:
- define an attribute (e.g. it is called “Home Email” and is of type “email”)
- add it to list of fields that Turba uses (so it is displayed in the right place)
- add the backend storage (so Turba can query/save the values)
For this example, we are adding the home and work email fields, which are compatible with the iPhone contacts. This post assumes you use a database backend, if you don’t then step 3 will be slightly different.
1: Define an attribute
Firstly, check the file turba/config/attributes.php and make sure the following is present:
$attributes['homeEmail'] = array(
'label' => _("Home Email"),
'type' => 'email',
'required' => false,
'params' => array('allow_multi' => false, 'strip_domain' => false, 'link_compose' => true)
);
This defines the field “Home Email”. In recent versions of Horde this should already exist, so you shouldn’t need to modify the config. If you are creating a different type of field that does not exist already, it is easiest to copy the definition of something similar and change the label and attribute name.
2: Tell Turba we want to use this field
Next the file turba/config/sources.php needs to be edited. Find the line 'email' => 'object_email' and add below it the following two lines:
'homeEmail' => 'object_homeemail', 'workEmail' => 'object_workemail',
This tells Turba that the fields homeEmail and workEmail come from the database fields object_homeemail and object_workemail, respectively. We also need to modify the list of tabs so that Turba knows to display our new values in the right place.
Email addresses should go on the “Communications” tab, after the existing email field, so we modify the array and insert the attribute names like below:
_("Communications") => array('email', 'homeEmail', 'workEmail', 'homePhone', 'workPhone',
'cellPhone', 'fax', 'pager'),
3: Add the backend storage
Assuming you use a database backend, this is as easy as creating two new fields in the database. They should be named according to the values in sources.php that we defined above and should be similar to an existing row of the same type. As we are creating email fields, we can use the same data type as the object_email row.
For this example, the following SQL will modify the database appropriately:
ALTER TABLE `turba_objects` ADD `object_homeemail` VARCHAR( 255 ) NOT NULL AFTER `object_email`, ADD `object_workemail` VARCHAR( 255 ) NOT NULL AFTER `object_homeemail`
The same process above can be followed for other fields that might be missing, post a comment if there is something that you’d like help adding.






[...] This is very easy to fix, but you’ll need to ask your system administrator to have a look at this post on my [...]
Thanks a lot. I’ve been looking at how to fix this.
Great easy to follow instructions
Hi David,
I simply wanted to add that this works also on blackberry (using the Funambol Client 8.7.1).
I was not sure that the client was using the same field but a debug of Horde confirm me that the fields were the same.
Thanks a mill for your post, I finally get evolution in sync with my mobile now o/
Hi,
I’ve been using open source version of Funambol server with syncevolution and Funambol client form Android phone. Everything works more of less fine. However I don’t really like maintaining this Funambol server in addition to Horde. Based on your findings I’ve been able to use Horde as a synchronization server. It works perfectly fine with syncevolution, but for android funambol client I still can’t get additional email addresses synced ;-( Moybe you have any other “hits”?
Thank you in advance,
Vlad.
just what I was looking for! Thanks a lot!
With horde4, the attributes are already defined, no need to change anything. sources.php is now backends.php and should not be edited – instead create an empty backends.local.php with the following contents:
$cfgSources['localsql']['map']['homeEmail'] = ‘object_homeemail’;
$cfgSources['localsql']['map']['workEmail'] = ‘object_workemail’;
$cfgSources['localsql']['tabs'][_("Communications")][] = ‘homeEmail’;
$cfgSources['localsql']['tabs'][_("Communications")][] = ‘workEmail’;
I didn’t set the table attributes in the db “NOT NULL”. guess we don’t need that…