Kimai Forum
Kimai - Time Tracking Community
September 09, 2010, 12:21:29 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Kimai v 0.9.0.1082 final ready for download
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Upload Custmers from existing table  (Read 491 times)
anna
Kimai Newbie
*
Posts: 3


View Profile
« on: February 10, 2010, 03:23:50 PM »

I already have a huge list of customers in mySQL database, and I am wandering if I can just upload those instead of manually type them in.
Thank you
Logged
ServiusHack
Global Moderator
Kimai Guru
*****
Posts: 609


View Profile
« Reply #1 on: February 10, 2010, 07:17:20 PM »

Using some SQL or a small script you are able to import your data into Kimai. Take a look at the table kimai_knd, this is where customer data is stored. For group associations see kimai_grp_knd. But Kimai doesn't provide some sort of import functionality. So scripting or doing it by hand are the only possibilities I see.

Best Regards,
Severin Leonhardt
Logged
anna
Kimai Newbie
*
Posts: 3


View Profile
« Reply #2 on: February 12, 2010, 12:52:38 AM »

Thank you, I appreciate your quick response. I am new to scripting and programming in general. Could you please give me some general example of a script and what file I could put it in. If I am asking too much, could you just lead me to files where I can see some examples.
Thank you
Logged
ServiusHack
Global Moderator
Kimai Guru
*****
Posts: 609


View Profile
« Reply #3 on: February 12, 2010, 08:22:46 PM »

A starting point might a SQL query like
Code:
INSERT INTO kimai_knd ('knd_name') SELECT customer_name FROM old_table

This copies all values in the column customer_name form table old_table into the table kimai_knd in the column knd_name.
Information about the INSERT INTO ... SELECT statement can be found for example at http://www.1keydata.com/sql/sqlinsert.html . If you need more information about this use your preferred search engine.

Also don't forget to add an entry into kimai_grp_knd for each new customer. A spontaneous idea:
Code:
INSERT INTO kimai_grp_knd ('grp_ID', 'knd_ID') SELECT 1, knd_ID FROM kimai_knd

You can execute those queries from a command line client or using something like phpMyAdmin.

I hope this helps you to find out how to do it. And please don't use your production database for testing this. Smiley

Best Regards,
Severin Leonhardt
Logged
anna
Kimai Newbie
*
Posts: 3


View Profile
« Reply #4 on: February 14, 2010, 02:55:22 PM »

Thanks. It helped Smiley
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF | Simple Machines LLC