Project

General

Profile

Actions

Defect #18095

open

Unable to submit time entries via REST API for activities that have become project-specific

Added by Alex MacAulay about 10 years ago. Updated about 10 years ago.

Status:
Confirmed
Priority:
Normal
Assignee:
-
Category:
REST API
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

Steps to reproduce: Create a new project. In web interface, go to "Settings" tab, then go to "Activities (time tracking)" tab. Deactivate an activity (let's say "Design") by unchecking the checkbox. Click "Save". Then reactivate the activity by re-checking the checkbox. Click "Save".

At this point, there is a project-specific activity for the "Design" activity in the Redmine database, in addition to the system-level "Design" activity. So the first question could be: is this a bug? Should the project-specific activity no longer exist when it has been reactivated? For the moment, I'll assume that it is reasonable that it continues to exist.

So, now I make a request to the REST API to get an enumeration of the time entry activities (GET /enumerations/time_entry_activities.xml). It returns only the system-level time entry activities.

However, if I use the web interface to submit a time entry on the "Design" activity for my project via the web interface, it uses the project-specific ID for the time entry.

This inconsistency between the behavior exposed via the REST API and the web interface means that I'm unable to submit time entries via the REST API for project-specific activities, because the REST API does not give me the IDs of those activities.

In order to resolve the bug, I would propose to modify the code that adds time entries in order to converts a system-level time entry activity ID to the corresponding project-specific time entry activity ID if it exists. I've attached a proposed patch.

For reference, here is the output of ruby script/about:

Environment:
  Redmine version                2.5.2.devel.13434
  Ruby version                   1.8.7-p352 (2011-06-30) [x86_64-linux]
  Rails version                  3.2.19
  Environment                    production
  Database adapter               PostgreSQL
SCM:
  Subversion                     1.6.11
  Git                            1.7.1
  Filesystem
Redmine plugins:
  no plugin installed

Files

Actions

Also available in: Atom PDF