6.0.0-git
2018-12-12
Last Modified 2014-09-02 by Guest

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

Applies to: Turba 3/4 with a mySQL backend.

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

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

'email' => 'object_email' 

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

/* 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)
);

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.:

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

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.

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

'email' => 'object_email',
'homeEmail' => 'object_email2',
'workEmail' => 'object_email3',

Turba 4: uncomment "homeEmail" and "workEmail" in backends.local.php

'email' => 'object_email',
'homeEmail' => 'object_homeemail',
'workEmail' => 'object_workemail',

Turba 3: 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!
Turba 4: No need for creating extra fields, they are already there!

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:

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

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:

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

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

Hope that helps!