プロジェクト

全般

プロフィール

Defect #1385

Undefined method value_was for TimeEntryCustomField

S B2年以上前に追加. 2年以上前に更新.

ステータス:
終了(Closed)
優先度:
通常(Normal)
担当者:
対象バージョン:
開始日:
2015/07/08
期日:
進捗率:

100%

予定工数:

説明

When trying to use the plugin WorkTime I have an internal error only if I have a time entry custom field.

Started GET "/redmine/work_time/show/my-project-id?day=8&month=7&prj=false&user=7&year=2015" for 10.1.4.22 at 2015-07-08 09:17:40 +0200
Processing by WorkTimeController#show as HTML
  Parameters: {"day"=>"8", "month"=>"7", "prj"=>"false", "user"=>"7", "year"=>"2015", "id"=>"my-project-id"}
  Current user: myuserid (id=7)
  Rendered plugins/redmine_work_time/app/views/work_time/_select_project.html.erb (17.8ms)
  Rendered plugins/redmine_work_time/app/views/work_time/_select_user.html.erb (1.7ms)
  Rendered plugins/redmine_work_time/app/views/work_time/_user_month_table.html.erb (33.9ms)
  Rendered plugins/redmine_work_time/app/views/work_time/_user_day_table.html.erb (17.5ms)
  Rendered plugins/redmine_work_time/app/views/work_time/show.html.erb within layouts/base (73.9ms)
Completed 500 Internal Server Error in 143ms (ActiveRecord: 9.8ms)

ActionView::Template::Error (undefined method `value_was' for #<TimeEntryCustomField:0x0000000b448c60>):
    166:       nil
    167:     end
    168:   %>
    169:      <td><%= custom_field_tag "new_time_entry["+issue_id.to_s+"][0]", cf %></td>
    170:   <% end %>
    171: </tr>
    172: <%
  lib/redmine/field_format.rb:615:in `possible_custom_value_options'
  lib/redmine/field_format.rb:484:in `select_edit_tag'
  lib/redmine/field_format.rb:454:in `edit_tag'
  app/helpers/custom_fields_helper.rb:73:in `custom_field_tag'

It seems that a custom field of type TimeEntryCustomField does not have the value_was method.

My configuration :

Environment:
  Redmine version                3.0.3.stable
  Ruby version                   1.9.3-p448 (2013-06-27) [x86_64-linux]
  Rails version                  4.2.1
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.6.17
  Git                            1.7.10.4
  Filesystem                     
Redmine plugins:
  redmine_base_deface            0.0.1
  redmine_custom_workflows       0.1.0
  redmine_latex_mathjax          0.1.0
  redmine_maintenance_mode       2.0.1
  redmine_work_time              0.3.0
  redmine_workflow_enhancements  0.4.0

関係しているリビジョン

リビジョン 396:9d33ff598a3f (差分)
Tomohisa Kusukawa2年以上前に追加

fixes #1385 Undefined method value_was for TimeEntryCustomField

リビジョン 402:8745917bcc15 (差分)
Tomohisa Kusukawa2年以上前に追加

fixes #1385 there is no date control for date custom field

履歴

#1 S B2年以上前に更新

I have made some tests :
  • if the format of the spent time custom field is "User" or "Version" the described error occured when showing the WorkTime plugin.
  • if the format of the spent time custom field is Text, Boolean, Number... there is no error and we can see the custom field in the table displayed by the Worktime plugin.

The Redmine Team said the error is not in Redmine Core : http://www.redmine.org/issues/20270#note-1

The error message indicates that the error occured in plugins/redmine_work_time/app/views/work_time/_user_day_table.html.erb:

  <%@custom_fields.each do |cf|
    def cf.custom_field
      return self
    end
    def cf.value
      return self.default_value
    end
    def cf.true?
      return self.default_value
    end
    def cf.customized
      nil
    end
  %>
     <td><%= custom_field_tag "new_time_entry["+issue_id.to_s+"][0]", cf %></td>
  <% end %>

I have made other test on the code of the plugin:
  • If I replace custom_field_tag by custom_field_tag_for_bulk_edit there is no error.

#2 Tomohisa Kusukawa2年以上前に更新

  • ステータス新規(New) から 解決(Resolved) に変更
  • 進捗率0 から 100 に変更

更新履歴 9d33ff598a3f で適用されました。

#3 Tomohisa Kusukawa2年以上前に更新

  • 担当者S B にセット
  • 対象バージョン0.3.1 にセット

Hi, S B.

Thank you so much for your report!

It's fixed in 9d33ff598a3f .

Could you to try recent repository of Bitbucket ,if you have time.

#4 S B2年以上前に更新

Hi Tomohisa,

I have tried the last repository (https://bitbucket.org/tkusukawa/redmine_work_time/get/18b904e63cc2.zip): the bug is fixed.

Changing the value of the custom field works : we have the list control if applicable.
Adding a ticket on the worktime sheet works also.

The only thing is that there is no date control for date custom field : we have a textbox control, not a calendar.

Thanks you !

#5 Tomohisa Kusukawa2年以上前に更新

Thank you so much again, S B.

I fixes reported(date custom field) problem at 8745917bcc15 .

If you have any other problem, please let me know.

#6 Tomohisa Kusukawa2年以上前に更新

  • ステータス解決(Resolved) から 終了(Closed) に変更

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