- Time Tracking
- Track your time spent on Tickets, via a calendar view
- Client Store, iTop Hub
This extension provides a way to track the time spent by the end-users in association with objects in iTop (like Tickets). The user input is done via a Google-like calendar via (provided by FullCalendar JS), either directly as an extra tab on the target object, or via a special page and its menu “Track my time”.
The module also provides two menus pointing to reports:
“My time tracking report” reports of the activities of the current user only.
“Time tracking report” takes into account the activities of all users.
The implementation provided by this extension limits the time tracking to User Requests and Incidents tickets.
Customized scopes for each time tracking feature
Interactive time tracking via a calendar or a stopwatch
Configure your calendar settings, activity colors etc..
Activity customization per user
Daily / weekly / monthly reports with multiple filtering criteria
Cumulated bar chart grouped by User or Customer
|2021-09-29||2.3.2||* Fix compatibility with iTop 3.0.1+|
|2021-09-29||2.3.2||* Prettier displays with iTop 3.0
* Fix dependencies to deprecated libraries in iTop 3.0
* Security hardening
|2021-06-02||2.2.1||* Fix modal mode being considered as classic mode|
|2021-05-11||2.2.0||* Allow copy-paste of “time spent” on calendar
* Manage TimeSpent mandatory fields on creation from calendar
* Allow to filter report page with custom query
* Improve performances with large object scopes
* Apply user obsolescence preference on report page overview
* Harmonize TimeSpent create/modify rights
|2021-01-08||2.1.2||* Add overview missing dictionary entries
* Fix Activity class format
* Fix dependency with legacysearchbase
|2020-11-04||2.1.1||Fix installation issue|
|2020-08-03||2.1.0||* Fix data not being filtered by search on report
* Add an overview for Time tracker manager in report page
* Add silo for managers in config
* Add configuration for report chart in config
* Align chart color with time tracking colors
|2019-09-18||2.0.0||Release 2 with a complete redesign and features set|
|2018-08-02||1.0.2||Compatibility with iTop 2.5|
The report page does not takes the selected organization into account when reporting time spent.
The detailed list of activities is limited to the selected organization, but the overview, total duration and charts do show time spent for all organizations.
The same occurs for the calendar tracking page, it displays Activities and TimeSpent for all organizations.
Use the Standard installation process for this extension.
The migration procedure consists in executing the SQL request below in order to migrate the former data structure to the new one. You have to execute those queries before tracking time
CREATE TABLE activity_legacy AS SELECT id,person_id,start_date,start_time,duration,end_time,ticket_id,description FROM activity; INSERT INTO activity (obj_id,obj_class,background_color,text_color,label) SELECT DISTINCT a.ticket_id, t.finalclass,'#0000ff','#ffffff',t.ref FROM activity_legacy AS a JOIN ticket AS t ON a.ticket_id=t.id; INSERT INTO timespent (id,user_id,start_date,end_date,duration,org_id,title,description,contact_id,activity_id) SELECT ts.id, u.id, concat(ts.start_date," ",ts.start_time), concat(ts.start_date," ",ts.end_time), TIMESTAMPDIFF(SECOND,concat(ts.start_date," ",ts.start_time),concat(ts.start_date," ",ts.end_time)), t.org_id, t.ref, ts.description, ts.person_id, a.id FROM activity_legacy AS ts LEFT JOIN priv_user AS u ON ts.person_id = u.contactid JOIN ticket AS t ON ts.ticket_id=t.id JOIN activity AS a ON a.obj_id=ts.ticket_id AND a.obj_class = t.finalclass; ALTER TABLE activity DROP person_id, DROP start_date, DROP start_time, DROP duration, DROP end_time, DROP ticket_id, DROP description; UPDATE priv_changeop SET objclass = "TimeSpent" WHERE objclass = "Activity"; DELETE FROM activity WHERE obj_id = 0;
'itop-time-tracking' => array( 'allowed_classes' => array ( 'UserRequest' => array( 'calendar-tab' => 'SELECT UserRequest WHERE status != "closed"', 'calendar-page' => 'SELECT UserRequest WHERE status != "new"', 'stopwatch' => 'SELECT UserRequest', 'report-tab' => 'SELECT UserRequest WHERE status != "closed"', ), 'Incident' => array( 'stopwatch' => 'SELECT Incident' ) ), 'colors' => array( 'default_stopwatch' => array('text'=> '#ffffff', 'background'=> '#a6a6a6'), 'default_calendar' => array('text'=> '#ffffff', 'background'=> '#FFCC80'), 'classes' => array( 'UserRequest' => array('text'=> '#ffffff', 'background'=> 'shadeof:blue'), 'Incident' => array('text'=> '#ffffff', 'background'=> 'shadeof:green') ) ), 'clone_events' => false, // Set to true to allow event cloning 'default_event_duration' => '00:30:00', 'day_start_time' => '04:00:00', 'day_end_time' => '21:00:00', 'excluded_days' => array('Saturday','Sunday'), 'first_day' => 1, 'business_hours'=> array( 'days_of_week' => array('1', '2', '3', '4', '5'), 'start' => '04:00:00', 'end' => '21:00:00', ), 'minimum_event_duration_display' => '00:30:00', 'stopwatch_clean_periodicity' => 12, 'stopwatch_max_time' => 12, 'delete_max_event_age' => 30, 'default_report_query' => 'SELECT TimeSpent WHERE contact_id = :contact_id AND start_date >= :start_date AND end_date < :end_date', 'manager_report_query' => 'SELECT TimeSpent WHERE start_date >= :start_date AND end_date < :end_date', 'manager_report_silo' => 'SELECT Person', 'weekly_report_time_spent_attribute' => '', 'weekly_report_time_spent_default' => '30hrs', 'report_charts_definition' => array( array('group_by_attribute' => 'contact_id', 'label' => 'TimeTracking:ReportActivityPerUser'), array('group_by_attribute' => 'org_id', 'label' => 'TimeTracking:ReportActivityPerCustomer') ), ),
|allowed_classes||array of type of class for which time tracking is allowed. For each class you can define a array of time tracking mode you allow.|
|colors||array defining the default colors globaly and by type of object. The array default_stopwatch defines the default color for a stopwatch. The array default_calendar defines the default color for time tracked in a calendar view. The you can define an array for each type fo object (classes) to define a default color for this one|
|default_event_duration||duration of an activity by default||30 minutes|
|clone_events||Since 2.2.0 of this extension. Allow user to clone time spent||false|
|day_start_time||start time in the calendar view||6:00|
|day_end_time||end time in the calendar view||22:00|
|excluded_days||days that are excluded from the calendar view||saturday, sunday|
|first_day||first day in the calendar view 0 is Sunday, 1 is Monday||1:Monday|
|business_hours||array describing the business hours||Monday to Friday 8:00 - 18:00|
|minimum_event_duration_display||minimum duration displayed in a calendar view even if the time spent is lower||30 minutes|
|stopwatch_clean_periodicity||periodicity to stop checking if a stop watch has to be stopped||1 hour|
|stopwatch_max_time||max duration in hours of a stopwatch if it is not stop manualy by a user||4 hours|
|delete_max_event_age||duration in days after which a user cannot modify or create a time spent||30 days|
|default_report_query||Since 2.1.3 Time spent scope for self report (available placeholder: contact_id, start_date, end_date corresponding to the contact and time fram selected in the filtering box))||SELECT TimeSpent WHERE contact_id = :contact_id AND start_date >= :start_date AND end_date < :end_date|
|manager_report_query||Since 2.1.3 Time spent scope for self report (available placeholder: contact_id, start_date, end_date)||SELECT TimeSpent WHERE start_date >= :start_date AND end_date < :end_date|
|manager_report_silo||The silo describing what Contacts Time Tracking Managers will be able to see. This filter is not correlated with manager_report_query||SELECT Person|
|weekly_report_time_spent_attribute||Attribute describing the expected time shown in Time Tracking Manager Overview||empty|
|weekly_report_time_spent_default||Describe the default value in case `weekly_report_time_spent_default` is empty (can be a dictionary entry)||'30hrs'|
|report_charts_definition||Define the charts displayed at the bottom of Time Tracking report page||cf below|
Time tracking modes
calendar tab : the user is allowed to set time tracking in a tab directly on the corresponding objects
calendar page : the user can track time in “My time tracking” page for the corresponding objects
stopwatch : the user cans track time using a stopwatch for the corresponding objects
report-tab : a reporting tab is displayed for the corresponding objects
Either use an hexadecimal color, or use a shadeof:color where color is one of the following value and will pick randomly for each object a corresponding color.
A user can track her/his time in multiple way:
From the “Time Tracking” tab on the details of an object present in a “calendar-tab” scope
From the “Track my time” menu if objects are present in a “calendar-page” scope
From the stopwatch on the right of the screen on the details of an object present in a “stopwatch” scope
Two new profiles are defined with this extension:
Time Tracker: A user having this profile can only track time for himself and see only his time tracked
Time Tracking Manager: A user having this profile can track time for other and will have access to the time tracked by anybody
From the details of a ticket
An extra tab “Time Tracking” appears once the extension is installed. Inside the tab a calendar shows the activities associated with the ticket. The activities of the current user are shown in color, whereas the activities of all other users (on this object) and stopwatches appear in ```default_calendar``` and ```default_stopwatch``` color (see configuration). Clicking on an item in the calendar displays a popup to edit this event. To create a new activity, simply click and drag in the calendar. You also change the start date & time or the duration of an Activity by clicking it in the calendar.
From the "Track my time" menu
The same kind of editing is possible from the “Track my time” menu. You need to select an activity in the combobox, from there you set your favorite activities and customize its color.
The top search bare use auto-complete mecanism
To set your favorite activity, you just have to click on the “heart” icon.
To customize the color, you have to click on the “pencil” icon.
The drop down list display first your favorite activities, then other activities grouped by type (User Request, Customer Contract …)
Added in 2.2.0, when no activity is selected and you click to add a Time Spent, it falls back to the “classic mode” and prompt you to select one
You can pick a “classic mode” with the combobox always visible or a “modal mode” which prompts a modal each time to click and drag on the calendar.
Added in 2.2.0, you can clone an entry, using the top right cloning icon: it duplicates the entry, which you must then drag and drop or edit to move to another time.
Each calendar has multiple views: month, week, day ,list.
From the stopwatch
A simple icon appears on the right of eligible object. The icon will be black if the stopwatch is not running or green if it's tracking time at the moment.
Clicking on this icon will display the stopwatch widget with buttons to start/stop/reset the stopwatch and the recent tracking history of the object with few information : Contacts whom tracked time on this object, the time spent and its date, the origin of this tracked time (stopwatch or calendar)
If you start a stopwatch and go on another object, you'll be prompted by the widget that you are visiting an object while you track time on another object.
The extension provides some basic reporting capabilities via two menus: “Time tracking report” and “My time tracking report” and a “Time spent” tab on each object present in ```report-tab``` scopes (see configuration).
Those menus are available, only if the user has one of the time tracking profils. The “Time tracking report” menu is available only for the time tracking managers.
The result is a list of “TimeSpent” objects, which can be exported if needed.
Both menus show the same information, the only difference is that the latter is limited to displaying the activities of the current user only.
The report can be a daily / weekly or monthly report (use the “prev.” and “next” buttons at the top left to navigate to the desired date), and the results can be filtered by additional criteria.
Moreover, at the bottom of the page, several bars charts display the total activity, per day, grouped on one given dimension (User, Customers…)
The TimeSpent data can be retrieved by an OQL query and exported using the standard iTop export capability
Here are some query example to extract time spent information:
Time spent by the current user (My Time Spent)
SELECT TimeSpent WHERE user_id=:current_user_id
Time spent by Claude Monet
SELECT TimeSpent AS ts JOIN Person AS p ON ts.contact_id=p.id WHERE p.friendlyname='Claude Monet'
Time spent for a given organization
SELECT TimeSpent AS ts JOIN Organization AS o ON ts.org_id=o.id WHERE o.name='Demo'
This extension brings a new Trigger: Trigger (when a time tracking stopwatch times out) This one is triggered when a time spent stopwatch reach the threshold “stopwatch_max_time”
The class configured for this trigger is TimeSpentBackground ($this) and can be used as a placeholder in the related filter and Actions
You can use this trigger to inform a user that a TimeSpent stopwatch had been stopped automatically after a given delay
Question and Answer
Q: What happen if I suppress a ticket for which I
A: The TimeSpent related to this ticket is not suppressed, just the id of the Ticket is reset to 0.
Q: Can I add new fields on the TimeSpent
The class TimeSpent is defined in XML, so it can be customized to add additional attributes if required. If an additional mandatory attribute is required the TimeSpent edit box is pop-up (only since version 2.2.0)
being mandatory with no default value