CRM: TTTimecards

Timecards and products associated to trouble tickets. Add details of work done at different times with time and material used to solve a trouble ticket. Possibility of converting into invoice.


There are two packages of the module, one has all the files with modifications included and the other has onlyt the new files and a patch (diff) file to be applied to obtain the modified files. The only reason to use the patch is if you have modified the altered files on your system and don’t want to lose your modifications. A list of the modified files is include below.

ttimecard 1.0 GA Files

This package has all the modified files “AS IS” on my machine, no patch file.
The files that have changed only have new code of timecards, besides that they are the same as they were in 5.0.1GA. You can use this release if you haven’t modified these files for your personal needs.
I still recomend the patch release. For those of you on windows the vtiger wiki speaks about winmerge and I have seen that tortoise (from the svn project) has a tool for using patch files under windows. Sorry, no personal experience.

  • unzip files from top of source directory
  • execute config_timecards.php script with

zip file only adds new text strings to en_us files, if you are using a localized version you must add new strings to your locale.
I personally recomend installing Language Pack Wizard (on vtiger forge).

ttimecard 1.0 GA Patch

  • unzip files from top of source directory
  • apply patch file: modules/HelpDesk/TTTimeCards.diff
    patch -p 5 < modules/HelpDesk/TTTimeCards.diff
  • execute config_timecards.php script with

patch file only adds new text strings to en_us files, if you are using a localized version you must add new strings to your locale.
I personally recomend installing Language Pack Wizard (on vtiger forge).

Import 1.0 GA Files

  • Unzip the files form the root of your VTiger installation.

This may seem obvious but just in case: Please try the imports on a test installation before doing them on your production site. Murphy’s laws rule 

Import 1.0 GA Patch

  • Unzip the files form the root of your VTiger installation.
  • apply patch file from root of your VTiger installation: vcrm5.0_import_tttimecards0.1B.diff
    patch -p 1 < vcrm5.0_import_tttimecards0.1B.diff

This may seem obvious but just in case: Please try the imports on a test installation before doing them on your production site. Murphy’s laws rule 

Changes Timecards

modules/SalesOrder/language/en_us.lang.php Convert to SO errors
Timecards strings

New Code

A Smarty/templates/TimecardEditNewView.tpl
A + themes/bluelagoon/images/sortTT.gif
A + themes/blue/images/sortTT.gif
A + themes/woodspice/images/sortTT.gif
A + themes/alphagrey/images/sortTT.gif
A modules/HelpDesk/TimeCardUpdate.php
A modules/HelpDesk/TimeCardEdit.php
A modules/HelpDesk/TimeCardMvUp.php
A modules/HelpDesk/config_timecards.php
A modules/HelpDesk/TTTimeCards.diff
A + modules/HelpDesk/HDReceipt.php
A modules/HelpDesk/TimeCardDel.php
A modules/HelpDesk/images
A modules/HelpDesk/images/sortup.png
A modules/HelpDesk/images/sortdown.png
A modules/HelpDesk/images/del.png
A modules/HelpDesk/images/edit.png
A modules/HelpDesk/images/new.png
A modules/HelpDesk/CallTimeCardList.php
A modules/HelpDesk/TimeCardMvDown.php
A + modules/HelpDesk/CreatePDF.php
A + modules/HelpDesk/SortTT.php
A + modules/HelpDesk/HDTicket.php
A + modules/HelpDesk/pdf_templates
A modules/HelpDesk/TimeCardNew.php
A modules/HelpDesk/TTTimecards_Changelog.txt


M Smarty/templates/DetailViewHidden.tpl
M Smarty/templates/RelatedListContents.tpl
M Smarty/templates/DetailView.tpl
M Smarty/templates/Buttons_List1.tpl
M Smarty/templates/Buttons_List.tpl
M Smarty/templates/DisplayFields.tpl
M Smarty/templates/RelatedLists.tpl
M modules/SalesOrder/language/en_us.lang.php
M modules/SalesOrder/EditView.php
M modules/Home/UnifiedSearch.php
M modules/HelpDesk/language/en_us.lang.php
M modules/HelpDesk/DetailView.php
M modules/HelpDesk/HelpDesk.php
M include/utils/EditViewUtils.php
M include/utils/InventoryUtils.php
M include/utils/ListViewUtils.php
M tabdata.php
M index.php
M parent_tabdata.php

See install script config_timecards.php
You should use the configuration script which generates values based on your installation

Changes Import


New Code



Timecards are a relation of time, expenses and work done on a given troubleticket. The idea is to add timecards to a troubleticket as work is done, specialy over a laps of time (days or months) so we have a relation of all the work done to fix the problem.

Timecards are associated to a trouble ticket so you should see a new tab in between trouble ticket basic information and more information.

Once on the timecard tab you can either create a new timecard if none exits or move, edit, delete or create timecards if they already exist. There are graphic buttons for each of these operations.

A timecard can have either units, which will normaly be combined with products or simply time. The units field is basically for the Invoice Lines. If you select a product it indicates the units of that product which must be invoiced.

Each timecard is of a given type. Only timecards with a product assigned AND of type InvoiceLine will be converted to SalesOrder. The Comment and BlockedComment type are for those timecards which normally describe the solution and all the work that has been done. The idea is to have a report where all InvoiceLine and Comment timecards appear, this report can be given to the client with his finished work. The BlockedComments do not appear on this report so the timecards of this type are for internal usage.

The InvoiceLine timecards MUST have a product as a SalesOrder MUST have a product.

There is a check box at the bottom of the form that says “New Timecard”. If this is selected we are redirected to another new timecard, if it is not checked you go back to detail view. The idea is that the tech staff goes out with trouble tickets to visit clients and fix things. When they get back into the office they register all there work as a batch load and they appreciate not having to hit the create button every time. I’ll take into consideration having this option configurable.

The change status selectbox and the assign ticket to are shortcuts to change the troubleticket. This makes it easy to introduce a timecard of the type:

  • “Sent request for information” and change the status of the ticket to “Wait for Response”
  • “Installed operating system and fixed problem. Pass ticket to Tech Staff to take computer to client” and change the responsible of the ticket.


Trouble Tickets

I have added the import trouble ticket option to VTiger. This is a normal import as any other table, the only thing I didn’t do is implement the UNDO function so mark your troubleticket table to be able to eliminate any errors.

As any import you must have permission to import and must map the fields as needed and it is accesible through the import button.

This module is really independent from the timecards and can be used to import your tickets from your old system with nothing to do with timecards. You can install this package only and see nothing of timecards but still be able to import your trouble tickets.




The import timecards script does a direct import of a CSV file into the Trouble Ticket Timecards database table.

My initial idea was to integrate this into the CRM system, but due to the way I programmed the timecards and that I would have to modify the toolbar to add another import button for timecards which is something we are going to do only once, I decided to make this script where each importer can adapt the neccesary changes to their own CSV file.

This script reads the file modules/Import/timecards.csv and expects to find:

  • ticketid: this is the value of the vtiger_troubletickets.ticketid field for the ticket to which the timecard is to be associated. What I did was use the Import HelpDesk function to get all my Trouble Tickets into the VTiger system, during this process I mapped my ticketid in the old system to a custom field in VTiger. With this I could now run a select on the vtiger_ticketscf table to get the relation between my old system’s id’s and VTiger newly assigned id’s and use this relation to obtain the value needed in this field.
  • creatorid: name of the user who created the timecard, this user name is mapped to the same user name in VTiger system and if not found the current user (he who is importing) is used
  • createdtime: datetime of creation of the timecard. iso format: Y/m/d H:m:s
  • workerid: name of the user who did the timecard, this user name is mapped to the same user name in VTiger system and if not found the current user (he who is importing) is used
  • date field: the date the timecard was done. iso format: Y/m/d
  • time: time value which represents the total time spent on the timecard. iso format: H:m:s
  • productid: value of the vtiger_products.productid field, any mapping must be done by creator of the CSV file. If product does not exist an empty value is inserted
  • units: number of units of the timecard
  • type: value of the vtiger_timecardtypes.timecardtypes_id field, any mapping must be done by the creator of CSV file, if not found “Comment” line will be used
  • description


  • Neither Header nor Footer must be included
  • sort order is defined by the order in which timecards are read from file, ALL timecards of a given ticket MUST be together
  • All messages are sent to the VTiger logging system at level INFO
  • All inserts are made only in the vtiger_tttimecards table, so if anything goes wrong you only have to restore this table to it’s original state (make a copy before starting if it is not empty)

My experience:
I could have carefully constructed the timecards.csv file by making a php script that:

  • extracted timecards from my existing system IN ORDER
  • lookup the relation between existing tickets and vtigers tickets
  • pre-create all users (active or not) in the vtigercrm so the names would be significant
  • pre-create products and looked up the productid relation
  • My old system had a strange way of establishing the type of a timecard so I would have had to program that

But, since I enjoy learning new things I tried the KETTLE program from Pentaho to construct my CSV files (troubletickets and timecards).
The learning curve was small and the result spectacular. I recommend this tool to anybody who has to move data around from one app to another.
BTW: JPL TSolucio, is the company that helped in the i18n and Spanish translation of Kettle, and we are implementing Pentaho installations.


I have implemented a few of the basic reports I needed diretly into the system and in Spanish. Anybody who will need these reports will have to personalize the code (I will answer any questions and help with translation). If anybody translates the files correctly, please send me the corrected versions.

Some of the other reports I need I will wait for. They will be accomplished with our B.I. project.

These are what I had on my list:

  • Total accumulated time. Obtained in the Ticket Report and later with B.I.
  • Total accumulated time for each worker. B.I.
  • Timecards of each worker. Custom View
  • Finished Trouble Tickets. Custom View
  • Pending Trouble Tickets by worker. Custom View
  • Order trouble tickets, list of work to take out. New SortTroubleTickets Report.
  • User workorder o service ticket (without blocked comments). Obtained in the TicketReport.


  • Will be done
    • Move timecards to another troubleticket
    • Duplicate timecards
    • Show pending work of a client when a new ticket for that client is introduced into the system
    • Notification on convert to SO of TT with product timecard not invoiced
    • Out of specification: The product quantity in Quote, PO, SO and Invoice is Integer, so we can’t have things like: 0.5h of programming or 0.5 dinner!!
  • Small changes:
    • relate sales order and trouble ticket through “more information”
    • fill timecard description with product description on product select: I looked at this and it is rather complicated for the small benefit.
    • disable timecards from profile (tools)
    • add “total time” to ticket
  • Would be nice
    • blocks of hours
    • service agreements, guarantees, service post-sales


What I needed to start working with vtiger is what I have done. Once I have made the reports I will have covered my company’s needs, so the rest is on “left over time”, and you now that we usually don’t have much of that 

I await your feedback.
Thanks for trying this project.
Joe. JPL TSolucio, S.L.