Project

General

Profile

Actions

Defect #1302

closed

Log Time fieldset in IssueController#edit doesn't set default Activity as default

Added by Simone Carletti over 16 years ago. Updated over 16 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Time tracking
Target version:
Start date:
2008-05-26
Due date:
% Done:

100%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Even if you specified a default activity from /enumerations administration area, the edit issue controller always displays @activities without being aware of any settings.
The select tag always set the first item as the default.

I made a quick search (I can't provide a patch right now, perhaps I'll do when I'll be less busy) and here's some details you can use to debug the problem:

/views/issues/edit.rhtml

        <div class="splitcontentright">
        <p><%= time_entry.select :activity_id, (@activities.collect {|p| [p.name, p.id]}) %></p>
        </div>

time_entry instance default :activity_id should be set to @activities default activity id.

/controllers/issue_controller.rb

    if request.get?
      @custom_values = @project.custom_fields_for_issues(@issue.tracker).collect { |x| @issue.custom_values.find_by_custom_field_id(x.id) || CustomValue.new(:custom_field => x, :customized => @issue) }
    else
      # Update custom fields if user has :edit permission
      if @edit_allowed && params[:custom_fields]
        @custom_values = @project.custom_fields_for_issues(@issue.tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) }
        @issue.custom_values = @custom_values
      end

I would probably add here, within the request.get? conditional statement, a default value for new @time_entry values.


Files

fix-time_entry-initialization.diff (517 Bytes) fix-time_entry-initialization.diff Nobuhiro IMAI, 2008-06-13 17:58
Actions

Also available in: Atom PDF