Project

General

Profile

Actions

Feature #28234

closed

Add CSV Import for Time Entries

Added by Gregor Schmidt over 6 years ago. Updated about 5 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Importers
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

Preface

The imports controller was obviously built to be used for more than just issue imports. But since Redmine currently only supports issue imports, there are now some places, where assumptions about the issue import are hard-coded.

There are some plugins out there, which add other kinds of CSV imports to Redmine, but none of them seems to use the imports controller. I assume, it's because of the shortcomings mentioned above. I wanted to improve this situation, so I decided to build a time entry importer and - along the way - generalize the imports controller so that it's able to handle more than just issues.

Preparations

The first patch attached extracts the issue related view parts into partials which are determined by convention. They are all prefixed with the imported model name, i.e. _issues.

The issue related model parts are moved to the import model. Those are, e.g. the proper menu item, the authorization or the layout. Strictly speaking they should be located on the controller level, but I did not want to build sub classes of the imports controller for each and every kind of import.

Adding the time entry import

The second patch attached adds the time entry import. It's using the newly introduced extension points to fill in the blanks. To provide a way for the user to find the new import, I've added the timelog/_sidebar partial, similar to the one for issues. This new sidebar partial is now used in the timelog views and it contains a link to the import.

Note: within said partial, I've mis/re-used an i18n key label_time_entries_visibility_all since it was providing the desired text in German and English. I did not want to introduce a new key based on the existing one, since that would have probably caused major merge problems. If desired, I may of course do that anyway.

Closing notes

The second patch may of course also become a plugin. The main point of this patch (series) was it, to allow plugins to reuse the existing plugin infrastructure. Without the first patch though, a plugin author would need copy most of the views and functionality of the imports class, which is undesirable (at least for the plugin author).

Thank you for considering these patches.


Files

0002-Import-time-entries.patch (16.5 KB) 0002-Import-time-entries.patch updated version (v2) Gregor Schmidt, 2018-03-05 13:09
0001-Generalize-issues-imports.patch (16.4 KB) 0001-Generalize-issues-imports.patch updated version (v2) Gregor Schmidt, 2018-03-05 13:09
0001-Generalize-issues-imports.patch (22.6 KB) 0001-Generalize-issues-imports.patch updated version (v3) Gregor Schmidt, 2018-03-12 09:21
0002-Import-time-entries.patch (16.5 KB) 0002-Import-time-entries.patch updated version (v3) Gregor Schmidt, 2018-03-12 09:21

Related issues

Related to Redmine - Defect #31508: Add missing frozen strings and copyrightsClosedGo MAEDA

Actions
Related to Redmine - Patch #32196: Allow import time entries for other usersClosedJean-Philippe Lang

Actions
Related to Redmine - Feature #22913: Auto-select fields mapping in ImportingClosedGo MAEDA

Actions
Related to Redmine - Defect #33027: Fix missing closing div in _time_entries_fields_mapping.html.erbClosedGo MAEDA

Actions
Has duplicate Redmine - Feature #25578: Import spent timeClosed

Actions
Actions

Also available in: Atom PDF