Project

General

Profile

Plugins Directory » Redmine Toggl Plugin

Author: ozgur yazilimas
Website: https://github.com/ozguryazilimas/redmine_toggl
Code repository: https://github.com/ozguryazilimas/redmine_toggl
Registered on: 2018-07-10 (almost 6 years ago)
Current version: 0.7.2
Compatible with: Redmine 3.4.x, 3.3.x, 3.2.x, 3.1.x, 3.0.x
User ratings:   (1)

Redmine Toggl is a Redmine plugin to synchronize Toggl time tracking tool entries with Redmine time entries.
Requires redmine version >= 3.0.3

Features

Synchronize Toggl entries for users that has Toggl API key set in Redmine
Automatically create / update / delete Redmine time entry for related issue
Time entry activities can be mapped to tags on Toggl entries. You can define which Toggl tag matches which Redmine time entry activity on Redmine Admin plugin settings page.
User interface in Redmine for viewing (with search, sort etc. support) and managing entries
Create new entry, will create the entry in Toggl and sync to Redmine
Edit entries (description, start time, duration, project, task workspace both in Toggl and in Redmine), will also update related Redmine time entry if any
Delete entry, will delete from Toggl and Redmine if any. Currently if you delete the entry on Toggl, it is not deleted from Redmine automatically.
User rights are controlled with Redmine permissions

Installation notes

Go to plugins directory under your Redmine installation

cd /path/to/redmine/plugins

and put Redmine Toggl in plugins directory. For example, if you want to use the latest code in master branch you can clone the repository with git

git clone https://github.com/zaburt/redmine_toggl.git

Go to your Redmine installation directory, install necessary gems with bundler and migrate plugins to create the necessary database tables.

RAILS_ENV=production bundle install
RAILS_ENV=production bundle exec rake redmine:plugins:migrate

Restart Redmine. You will notice that in user profile pages there are two new custom fields

Toggl API Key: API token to be used to interact with Toggl. Every users API token must be configured separately. You can get your own token from Toggl Profile page.
Toggl Workspace: Optional. If set, only entries for given workspace will be synchronized. Multiple workspaces can be defined comma separated. If left blank, all workspaces will be synchronized.

You need at least one user API token set and at least one user that has permission in Toggl to see Toggl projects and tasks lists. Assuming Redmine user with login zaburt has API token configured in Redmine, and has permission in Toggl to get list of projects and tasks synchronize Toggl base data.

RAILS_ENV=production bundle exec rake toggl:sync_base_data[zaburt]

You only need to synchronize base data once. If you update projects or tasks in Toggl you can run the rake task again to update in Redmine.


Rake Tasks

Synchronize Toggl entries for all active Redmine users, that has their API token set in users profile. By default Toggl API provides entries for about last 9 days and maximum number of 1000 entries per user. See Toggl API docs for more information.

RAILS_ENV=production bundle exec rake toggl:sync_time_entries

You can also give a time range to sync time entries, time values must be in UTC. Note that Toggl API limitations still apply but you can call the rake task multiple times for different time ranges to synchronize larger time range. To fetch entries between "2016-01-10 12:00" and "2016-01-11 12:00" use the following command. Blank values will be ignored.

RAILS_ENV=production bundle exec rake toggl:sync_time_entries["2016-01-10 12:00","2016-01-11 12:00"]

Currently Toggl does not provide information on deleted entries if you are fetching multiple time entries, that is why sync_time_entries task does not delete entries that were deleted from Toggl but that are still in Redmine. If you want to delete these entries from Redmine too you can try the sync_time_entries_remove_missing task, which will first do what sync_time_entries does, and then tries to figure out if an entry was deleted from Toggl by comparing latest Toggl data and records in Redmine database. This will take slightly more time, though should be working smart so difference is not big. If you want real synchronization run this task instead.

There is one catch with this approach, if you have say 10 entries in Toggl, sync them to Redmine, then only add a new entry to Toggl (entry 11 becomes latest entry) and then delete it this rake task will not catch the deletion at first run. However, once you add another entry to Toggl, system will detect the deletion and remove the entry from Redmine.

You can combine both tasks if you want. For example, you can keep on running sync_time_entries how often you prefer (say once every hour) and run sync_time_entries_remove_missing instead at midnight, thus the removing synchronization will happen once a day. Rake task parameters are the same with sync_time_entries and they are not mandatory.

RAILS_ENV=production bundle exec rake toggl:sync_time_entries_remove_missing

To receive list of Toggl Entries that are not associated with a Redmine issue you can run the following rake task. Args are in the format of "hours,recipients,language". Hours option decides Toggl Entries started since how many hours ago. Recipients can be multiple email address pipe "|" separated. Language is optional, default is Redmine default.

RAILS_ENV=production bundle exec rake toggl:report_without_issue[24,"|","en"]

You can also get the same report for Toggl Entries that do not have Toggl Project selected

RAILS_ENV=production bundle exec rake toggl:report_without_project[24,"|","en"]

All rake tasks must be run in the Redmine installation location.

For further information you can visit https://github.com/ozguryazilimas/redmine_toggl

Changelog

0.7.2 (2018-01-02)

Compatible with Redmine 3.4.x, 3.3.x, 3.2.x, 3.1.x, 3.0.x.

User ratings

  by Ercan Demirel almost 6 years ago