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)
THIS ARTICLE IS BASED ON HERMES FOR HORDE 3.
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 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.
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).
1a. Create a new table.
Go to turba/scripts/sql and copy the file that you used to create your original Turba table. So, assuming that you are using MySQL, copy turba_objects.mysql.sql to something like turba_clients.mysql.sql. Edit the new file, turba_clients.mysql.sql and change all entries that have turba_objects and change them with the new name, turba_clients. You should encounter three instances of turba_objects, one for the CREATE TABLE, another for a CREATE INDEX, and the last for a GRANT commands.
Save your file and create the table. I.e., in MySQL do mysql -p < turba_clients.mysql.sql. Assuming you've had no errors, continue to step 1b.
1b. Edit 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 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 ;-)
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:
insert into turba_clients
SELECT * FROM turba_objects WHERE object_id IN (
select clientjob_id FROM hermes_timeslices
);
Those SQL cheats worked for me (Kev Green). Change the lines for the new entry to look like the below example.
create table turba_clients
SELECT * FROM turba_objects WHERE object_id IN (
select clientjob_id FROM hermes_timeslices
);
$cfgSources['hordeclientdb'] = array(
'title' => _("My Addressbook"),
'type' => 'sql',
'params' => array_merge($conf['sql'], array('table' => 'turba_clients')),
(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).
Step 2
Now tell Hermes which address book to use. Using an Administrator enabled login, go to 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 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.
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.
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.
1a. Log in to Turba as the account that you want to be the owner of the shared address book.
Array ( )
Array (
[0] => Array (
[name] => owner
[key] =>
[value] => mike
)
[1] => Array (
[name] => name
[key] =>
[value] => test
)
[2] => Array (
[name] => uid
[key] =>
[value] => 82e8f032c1ab043b5efaa4fde50653d2
)
.
.
.
Once you find the correct entry, copy down the uid (82e8f032c1ab043b5efaa4fde50653d2).
Turba 2.2 and up: The uid will be the name of the datatree entry so it is no longer