プロジェクト

全般

プロフィール

Vote #63286

完了

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

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Time tracking_13
対象バージョン:
開始日:
2008/05/26
期日:
進捗率:

100%

予定工数:
category_id:
13
version_id:
4
issue_org_id:
1302
author_id:
691
assigned_to_id:
0
comments:
4
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
3
ステータス-->[Closed]

説明

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

        

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

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.


journals

Fixed in r1461.
I fixed it at model level rather than in the controller. But thanks for pointing out the problem.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
After this change, new TimeEntry is always saved with default ACTI, even when
the another activity_id was sent from browser.

This is Rails fanon :-).

<pre>
>> Foo.belongs_to :bar
>> Bar.has_one :foo
>> foo = Foo.new
>> foo.bar = Bar.find(1)
>> foo.bar_id
=> 1
>> foo.bar_id = 2
>> foo.bar_id
=> 2
>> foo.save
=> true
>> foo.bar_id
=> 1
</pre>

The attached patch will fix this problem, I guess.

Thanks,

--------------------------------------------------------------------------------
Fixed in r1533. Thanks.
--------------------------------------------------------------------------------

Admin Redmine さんが約4年前に更新

  • カテゴリTime tracking_13 にセット
  • 対象バージョン0.7.2_4 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0