\documentclass{article}
\usepackage{ulem}
\usepackage{graphicx}
\usepackage{hyperref}
\pagestyle{headings}
\begin{document}
\textbf{Turba 2.2 ships with a default address book schema that is very well suited for synchronization with other address book clients. The steps described in this page are no longer necessary.}

\part{Turba Configuration suitable for SyncML}
\section{Turba with an SQL backend}
The sql script below provides a sql database schema and source.php snippet to make <a href="https://wiki.horde.org/SyncML">SyncML</a> work better with Turba address books. Run the sql script to create the table. You have to rename/delete/backup your original turba\_objects table first.

You also have to use the sources.php below or paste it into your existing sources.php (in the turba/conf directory)

Here's the sql script:

<pre><code>
CREATE TABLE `turba\_objects` (
 `object\_id` varchar(32) NOT NULL,
 `owner\_id` varchar(255) NOT NULL,
 `object\_type` varchar(255) NOT NULL default 'Object',
 `object\_uid` varchar(255),
 `object\_members` blob,
 `object\_lastname` varchar(255) NOT NULL default '',
 `object\_firstname` varchar(255),
 `object\_alias` varchar(32),
 `object\_nameprefix` varchar(255),
 `object\_email` varchar(255),
 `object\_homestreet` varchar(255),
 `object\_homecity` varchar(255),
 `object\_homeprovince` varchar(255),
 `object\_homepostalcode` varchar(255),
 `object\_homecountry` varchar(255),
 `object\_workstreet` varchar(255),
 `object\_workcity` varchar(255),
 `object\_workprovince` varchar(255),
 `object\_workpostalcode` varchar(255),
 `object\_workcountry` varchar(255),
 `object\_homephone` varchar(25),
 `object\_workphone` varchar(25),
 `object\_cellphone` varchar(25),
 `object\_fax` varchar(25),
 `object\_pager` varchar(25),
 `object\_title` varchar(255),
 `object\_company` varchar(255),
 `object\_notes` text,
 `object\_url` varchar(255),
 `object\_pgppublickey` text,
 `object\_smimepublickey` text,
 `object\_freebusyurl` varchar(255),
 `object\_role` varchar(255),
 `object\_category` varchar(80),
 `object\_photo` blob,
 `object\_blobtype` varchar(10),
 `object\_bday` varchar(10),

   PRIMARY KEY(object\_id)
);

CREATE INDEX turba\_owner\_idx ON turba\_objects (owner\_id);

GRANT SELECT, INSERT, UPDATE, DELETE ON turba\_objects TO horde@localhost;
</code></pre>
And here's the php code for \texttt{turba/conf/sources.php}. Replaces the existing \texttt{\$cfgSources['localsql']}.

<pre><code class="language-php">
\$cfgSources['localsql'] = array(
   'title' => \_("My Addressbook"),
   'type' => 'sql',
   // The default connection details are pulled from the Horde-wide SQL
   // connection configuration.
   //
   // The old example illustrates how to use an alternate database
   // configuration.
   //
   // New Example:
   'params' => array\_merge(\$GLOBALS['conf']['sql'], array('table' => 'turba\_objects')),

   'map' => array(
       '\_\_key' => 'object\_id',
       '\_\_owner' => 'owner\_id',
       '\_\_type' => 'object\_type',
       '\_\_members' => 'object\_members',
       '\_\_uid' => 'object\_uid',
       'name' => array('fields' => array('firstname', 'lastname'),
                       'format' => '\%s \%s'),
       'firstname' => 'object\_firstname',
       'lastname' => 'object\_lastname',
       'name\_prefix' => 'object\_nameprefix',
       'email' => 'object\_email',
       'alias' => 'object\_alias',
       'homeStreet'  => 'object\_homestreet',
       'homeCity'     => 'object\_homecity',
       'homeProvince'     => 'object\_homeprovince',
       'homePostalCode' => 'object\_homepostalcode',
       'homeCountry' => 'object\_homecountry',
       'workStreet' => 'object\_workstreet',
       'workCity'     => 'object\_workcity',
       'workProvince'     => 'object\_workprovince',
       'workPostalCode' => 'object\_workpostalcode',
       'workCountry' => 'object\_workcountry',
       'homePhone' => 'object\_homephone',
       'workPhone' => 'object\_workphone',
       'cellPhone' => 'object\_cellphone',
       'fax' => 'object\_fax',
       'pager' => 'object\_pager',
       'title' => 'object\_title',
       'company' => 'object\_company',
       'birthday' => 'object\_bday',
       'website' => 'object\_url',
       'notes' => 'object\_notes',
       'pgpPublicKey' => 'object\_pgppublickey',
       'smimePublicKey' => 'object\_smimepublickey',
       'freebusyUrl' => 'object\_freebusyurl'
   ),
   'search' => array(
       'name',
       'email'
   ),
   'strict' => array(
       'object\_id',
       'owner\_id',
       'object\_type',
   ),
   'export' => true,
   'browse' => true,
   'use\_shares' => true,
);
</code></pre>
Here is a first migration script, nothing spectacular nor perfect but better than nothing :

<pre><code>
ALTER TABLE turba\_objects ADD   object\_firstname VARCHAR(255);
ALTER TABLE turba\_objects ADD   object\_nameprefix VARCHAR(255);
ALTER TABLE turba\_objects ADD   object\_homecity VARCHAR(255);
ALTER TABLE turba\_objects ADD   object\_homeprovince VARCHAR(255);
ALTER TABLE turba\_objects ADD   object\_homepostalcode VARCHAR(255);
ALTER TABLE turba\_objects ADD   object\_homecountry VARCHAR(255);
ALTER TABLE turba\_objects ADD   object\_workcity VARCHAR(255);
ALTER TABLE turba\_objects ADD   object\_workprovince VARCHAR(255);
ALTER TABLE turba\_objects ADD   object\_workpostalcode VARCHAR(255);
ALTER TABLE turba\_objects ADD   object\_workcountry VARCHAR(255);
ALTER TABLE turba\_objects ADD   object\_pager VARCHAR(25);
ALTER TABLE turba\_objects ADD   object\_role varchar(255);
ALTER TABLE turba\_objects ADD   object\_category varchar(80);
ALTER TABLE turba\_objects ADD   object\_photo blob;
ALTER TABLE turba\_objects ADD   object\_blobtype varchar(10);
ALTER TABLE turba\_objects ADD   object\_bday varchar(10);
ALTER TABLE turba\_objects ADD   object\_url varchar(255);

//Replace name of the "full" field (definitively not perfect)
ALTER TABLE turba\_objects CHANGE object\_homeaddress object\_homestreet VARCHAR(255);

ALTER TABLE turba\_objects CHANGE object\_workaddress object\_workstreet VARCHAR(255);

ALTER TABLE turba\_objects CHANGE object\_name object\_lastname VARCHAR(255);
</code></pre>
\section{Turba with an LDAP backend}
The default LDAP configuration does not include a mapping for the firstname attribute.  Fortunately the LDAP schemas do provide such a field.  Simply add the following to the field maps in your sources.php to any LDAP source definitions:

<pre><code>
"firstname" => "givenname",
</code></pre>
One caveat:  Since the LDAP driver stores contacts using their full name as the object key, this will necessitate duplicately entering information in Turba.  You will see that three fields, First Name, Last Name, and Name are all required fields.  SyncML will handle this properly and automatically (by concatenating the users two name fields), but web users will see all three fields blank.  There may be alternative workarounds to this issue depending on your environment.

\end{document}
