Add CSV Import for Time Entries
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.
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.
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.
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.