[commits] [Wiki] created: TurbaExtraFields

Wiki Guest wikiguest at horde.org
Thu Jul 21 10:43:40 UTC 2011


guest [59.167.157.243]  Thu, 21 Jul 2011 10:43:40 +0000

Created page: http://wiki.horde.org/TurbaExtraFields

++How to Configure Turba to Display and Store up to 3 Email Addresses

+++Applies to: Turba 3 with a mySQL backend.

This was driven by the need to store 3 email addresses in Turba to  
ActiveSync with Apple iOS devices, which store up to 3 email addresses  
per contact.

The default SQL backend defined in backends.php defines only one email  
address:

<code>'email' => 'object_email'
</code>

However this is made easier by the fact that  
turba/config/attributes.php defines multiple emails as follows:

<code>
/* Communication. */
$attributes['email'] = array(
     'label' => _("Email"),
     'type' => 'email',
     'required' => false,
     'params' => array('allow_multi' => false, 'strip_domain' =>  
false, 'link_compose' => true)
);
$attributes['workEmail'] = array(
     'label' => _("Work Email"),
     'type' => 'email',
     'required' => false,
     'params' => array('allow_multi' => false, 'strip_domain' =>  
false, 'link_compose' => true)
);
$attributes['homeEmail'] = array(
     'label' => _("Home Email"),
     'type' => 'email',
     'required' => false,
     'params' => array('allow_multi' => false, 'strip_domain' =>  
false, 'link_compose' => true)
);
</code>

If you want them displayed with different names then create a  
'turba/config/attributes.local.php' file (so your changes don't get  
overwritten in upgrades) and rename the 'label' entries, e.g.:

<code>
$attributes['workEmail'] = array(
     'label' => _("Email 3"),
     'type' => 'email',
     'required' => false,
     'params' => array('allow_multi' => false, 'strip_domain' =>  
false, 'link_compose' => true)
);
</code>

Next you will need somewhere to put those email addresses in your  
backend, and you will need to tell Turba about those places in your  
backend.

In backends.local.php map the extra email attributes to some new SQL fields:

<code>
'email' => 'object_email',
'homeEmail' => 'object_email2',
'workEmail' => 'object_email3',
</code>

In mySQL create those extra fields - 'object_email3' and  
'object_email2' as varchar(255) and add indexes to speed up searching.  
I use WebMin to manage my server, so adding them is all GUI based. You  
can of course use console 'mysql' commands, that's up to you!

You now have storage for 3 email addresses in your backend, Turba has  
definitions for them, and knows where to store them. If you have tabs  
in your contacts display you will need to add the extra fields so they  
show up on the tab. My Communications tab is set up as follows:

<code>
_("Communications") => array('email', 'homeEmail', 'workEmail',  
'homePhone', 'workPhone', 'cellPhone', 'fax', 'pager')
</code>

I have relabelled mine so they show as "Email", "Email 2", and "Email 3".

You will also need to modify the search array in backends.local.php  
for the SQL data source:

<code>
'search' => array(
   'name',
   'email',
   'homeEmail',
   'workEmail'
),
</code>

That will make those fields searchable so that Imp can autocomplete  
email addresses from them.

Hope that helps!



More information about the commits mailing list