\documentclass{article}
\usepackage{ulem}
\pagestyle{headings}
\begin{document}
\part{ How to create a separate address book for use by Hermes}
(or how to stop all my friends from being listed when creating a timesheet entry)\newline
THIS ARTICLE IS BASED ON HERMES FOR HORDE 3.

\subsection{ Some insight on where Hermes (Time Tracking) gets it data for use within the pulldowns menu (as well as invoices, etc)}
Hermes requires a good working install of Turba (Address Book). This is because Hermes needs an address book for the clients names. Go to \texttt{Office -> Time Tracking -> Enter Time -> Client} to see what I am talking about. If you saw everyone in your address book as an option, then you probably have your default Turba address book selected (in Turba), annoying eh? My address books contain several hundred entries, causing that pulldown to look horrible.

Solution?  Create a separate address book for use by Hermes.

\subsection{ Step 1}
Let's create a new table that is exactly the same as the default address book but with a different name. For the purposes of this document, I will use the name hordeclientdb for the new database table. (This is assuming you are using a sql backend).

\subsubsection{ 1a.  Create a new table.}
Go to \texttt{turba/scripts/sql} and copy the file that you used to create your original Turba table.  So, assuming that you are using MySQL, copy \texttt{turba\_objects.mysql.sql} to something like \texttt{turba\_clients.mysql.sql}.  Edit the new file, \texttt{turba\_clients.mysql.sql} and change all entries that have \texttt{turba\_objects} and change them with the new name, \texttt{turba\_clients}. You should encounter three instances of \texttt{turba\_objects}, one for the \texttt{CREATE TABLE}, another for a \texttt{CREATE INDEX}, and the last for a \texttt{GRANT} commands.

Save your file and create the table.  I.e., in MySQL do \texttt{mysql -p < turba\_clients.mysql.sql}. Assuming you've had no errors, continue to step 1b.

\subsubsection{ 1b.  Edit  \texttt{turba/config/sources.php}.}
Add entries identical to the original table, leaving the original intact.

There is a bit of a cheat you can do in SQL (it has to be a recent version of MySQL\footnote{http://example.com/index.php?page=MySQL} if that is what you are using, eg. 5.x, maybe 4.x will do it) to get existing timeslice clients into your new table, I am not sure if Chuck will like it though ;-)

<pre>\newline
insert into turba\_clients\newline
SELECT * FROM turba\_objects WHERE object\_id IN (\newline
select clientjob\_id FROM hermes\_timeslices\newline
);\newline
</pre>

It will fall down if you use the above 'sql script' method, and your turba\_clients table has had any extra fields added to it though, so you must make sure they are the same.

Another cheat to make sure they are the same, combined with the above is:

<pre>\newline
create table turba\_clients\newline
SELECT * FROM turba\_objects WHERE object\_id IN (\newline
select clientjob\_id FROM hermes\_timeslices\newline
);\newline
</pre>

Those SQL cheats worked for me (Kev Green).

Change the lines for the new entry to look like the below example.

\begin{verbatim}

$cfgSources['hordeclientdb'] = array(
   'title' => _("My Addressbook"),
   'type' => 'sql',
   'params' => array_merge($conf['sql'], array('table' => 'turba_clients')),
\end{verbatim}

(Look over the rest of the entries for the new table, ensuring that it is readable, etc.)

This new source must be made 'browseable' (set the element 'browse' => true) otherwise the underlying search for 'all entries' will fail, and you'll get "There are no clients which you have access to" instead of a drop-down list of clients when you stop the clock on a timeslice. (Kev Green).

\subsection{ Step 2}
Now tell Hermes which address book to use.  Using an Administrator enabled login, go to \texttt{Administration -> Setup -> Address Book (turba) -> name of client address book}. In the field above, enter the name of the database you wish to use, we used \texttt{hordeclientdb}.

Populate the new table with just the names and addresses for your clients, within Turba as you would any addressbook entry.

Permission your users to see/use this new database.

Result? you should now have a nicely trimmed selection list.

\section{ Alternate solution}
If you are using Turba 2.1 or higher and are using shared address books, you can follow these steps.  For this example, we are using shares on a source called localsql and want to create a shared, client address book called Our Clients.

\subsection{ Step 1}
Create a new shared address book.  If you already have a shared address book created for your client list, skip to step 2.

\textbf{1a.} Log in to Turba as the account that you want to be the owner of the shared address book.\newline
\textbf{1b.} Click on \texttt{My Address Books},  choose a name for the new address book (Our Clients in this example).\newline
\textbf{1c.} Choose the new address book (Our Clients) in the \texttt{Edit Address Books} section, and click on \texttt{Edit Permissions}.  Set permissions appropriate to your needs.

\subsection{ Step 2}
While logged on as an administrator, go to \texttt{Administration -> DataTree} and expand the \texttt{horde.shares.turba} branch.  Expand the branch for your shared source ( localsql in this example) and locate the entry for the address book we just created.

\textbf{Turba 2.2 and up:} Shares are no longer hierarchical in nature, so you will not see the source type as described above.  You will only see a list containing an entry for every Turba share.

Now, the tricky part.  If you have a fairly large user base,  you will most likely have to browse through a good number of entries.  Most of the entries will be your user's default address books, these will be named after the user.  What you are looking for is an entry such as  \texttt{82e8f032c1ab043b5efaa4fde50653d2}.  These are user created address books.  In our example, the one we are looking for will have something like this when you expand it:

\begin{verbatim}

Array ( )
Array (
   [0] => Array (
       [name] => owner
       [key] =>
       [value] => mike
    )
   [1] => Array (
       [name] => name
       [key] =>
       [value] => test
    )
   [2] => Array (
       [name] => uid
       [key] =>
       [value] => 82e8f032c1ab043b5efaa4fde50653d2
    )
    .
    .
    .
\end{verbatim}

Once you find the correct entry, copy down the uid (82e8f032c1ab043b5efaa4fde50653d2).

\textbf{Turba 2.2 and up:} The uid will be the name of the datatree entry so it is no longer\newline
required to exand the datatree entry to find it, although it might make it easier to copy\newline
and paste if you do so.

\subsection{ Step 3}
Go to the \texttt{Administration -> Setup -> Address Book (turba)} and fill the following in to the Name of Client Addressbook field:

\texttt{localsql:82e8f032c1ab043b5efaa4fde50653d2}

That's the source name (localsql) followed by a colon, followed by the uid of the address book we want to use.

\textbf{Turba 2.2 and up:} You no longer should include the source type in the name.  For the above example, the correct value to enter in the Name of Client Addressbook field would be \texttt{82e8f032c1ab043b5efaa4fde50653d2}.

Your shared client address book should now be visible in Hermes, without having to create an entirely seperate sql source.

\section{ Alternate solution 2 - MySQL}
If you are using mysql as backend for the Shares \texttt{Administration -> Setup -> Horde (horde) -> Shares} then you'll need to get the addressbook uid from the manage addressbook section.

\subsection{ Step 1}
Go to \texttt{Organizing -> Adress Book -> My Adress Book}. Set the permissions accordingly and then right-click "Edit" icon. You should be able to the "Link Location". Depending on your browser it may be called a bit different.

\subsection{ Step 2}
Go to \texttt{Administration -> Setup -> Address Book (turba)} and fill the paste the copied link in to the Name of Client Addressbook field (it will look something like this):

\texttt{http://domain.com/horde/turba/addressbooks/edit.php?a=cf5f669fdd0477984384d248efcf7f1c\footnote{http://domain.com/horde/turba/addressbooks/edit.php?a=cf5f669fdd0477984384d248efcf7f1c}}

No cut everything before the "=" so that it looks like this:

\texttt{cf5f669fdd0477984384d248efcf7f1c}

After you save this your shared client address book should now be visible in Hermes.

\end{document}
