creating a local app to handle punches

Discussion for TimeTrex open source community developers.
Locked
scosaunders
Posts: 43
Joined: Thu Jul 17, 2008 7:05 pm

creating a local app to handle punches

Post by scosaunders »

I'm considering creating a local app to handle/control punches and interact directly with the timetrex database. Right now I'm looking for some pointers and direction in how I might accomplish this without affecting any timetrex functions or scheduled tasks; my app would be transparent to timetrex. What tables are modified when a punch is created? What files are involved for creating a punch? Any help is appreciated, thanks.
scosaunders
Posts: 43
Joined: Thu Jul 17, 2008 7:05 pm

Post by scosaunders »

from browsing through the database after some recent punches it looks like creating a punch seems to modify the exception, punch, punch_control, user_date, and user_date_total tables and maybe system_log, unless thats updated automagically(by a trigger maybe)...

please feel free to verify or correct that observation

Perhaps someone has already done this (refer to orig. post) or something similar and could provide the sql statements they used to accomplish the task.
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

Modifying the database directly in this way is guaranteed to cause yourself a ton of headaches and problems, especially if you plan on upgrading TimeTrex to a new version at any point.

Instead you should be using the TimeTrex API to do what you want, and let it handle the database side of things for you.
scosaunders
Posts: 43
Joined: Thu Jul 17, 2008 7:05 pm

Post by scosaunders »

That's an understandable consideration. I guess I wasn't thinking about in the case of an upgrade.

Where is the best place to get started in using the TimeTrex API and doing what I have described?
shaunw
Posts: 7839
Joined: Tue Sep 19, 2006 2:22 pm

Post by shaunw »

I'm not quite sure what you are trying to do, but the best place is to look at the code on the TimeTrex pages that currently do something similar to what you are looking for. ie:

interface/punch/punch.php

Another resource is the API manual.
http://www.timetrex.com/help/developers/standard/
Locked