Project

General

Profile

Actions

Defect #17446

closed

Error when editing custom field with blank min_length or max_length

Added by R Sonnenberg almost 10 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Normal
Category:
Time tracking
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Hi,

after adding a custom field to my time tracking, adding and editing time entries always fails when this custom field has been filled.
I've tried 2 different custom field, both lead to the exact same error:

  • Custom field of type 'Integer', not mandatory, added to Spent Time
  • Custom field of type 'Boolean', not mandatory (obviously), added to Spent Time

I can add the fields without any issue, and when I leave them empty, I can still add time entries, but when either (or both) custom field is filled, I get an 500 internal server error.

The error log shows the following details:

Started PUT "/projects/l-t-media/time_entries/46" for 213.127.211.250 at 2014-07-11 09:29:00 +0200
Processing by TimelogController#update as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"<removed for security reasons>", "back_url"=>"http://<removed for security reasons>/projects/myproject/time_entries", "time_entry"=>{"issue_id"=>"", "spent_on"=>"2014-07-10", "hours"=>"1.0", "comments"=>"Reistijd Nijmegen-Arnhem-Nijmegen", "activity_id"=>"12", "custom_field_values"=>{"6"=>"64"}}, "commit"=>"Bewaren", "project_id"=>"myproject", "id"=>"47"}
  Current user: Rinck (id=1)
Completed 500 Internal Server Error in 11.7ms

NoMethodError (undefined method `>' for nil:NilClass):
  app/models/custom_field.rb:355:in `validate_field_value_format'
  app/models/custom_field.rb:334:in `validate_field_value'
  app/models/custom_field_value.rb:46:in `validate_value'
  lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb:126:in `each'
  lib/plugins/acts_as_customizable/lib/acts_as_customizable.rb:126:in `validate_custom_field_values'
  app/controllers/timelog_controller.rb:155:in `update'
Environment:
  Redmine version                2.4.2.stable
  Ruby version                   1.9.3-p0 (2011-10-30) [x86_64-linux]
  Rails version                  3.2.16
  Environment                    production
  Database adapter               Mysql2
SCM:
  Filesystem                     
Redmine plugins:
  no plugin installed
Additional info:

Since I installed Redmine from the default Ubuntu 12.04 repositories, it is not easy for me to upgrade to the latest version to test it there. I do have an older version of Redmine running on a different server (running redmine 1.3.2) and that instance has the exact same custom fields and it works like a charm.

Hoping someone can get this fixed! :)

Actions #1

Updated by R Sonnenberg almost 10 years ago

Sorry about messing up the formatting, I missed a closing /pre tag and cannot edit the message myself..

Actions #2

Updated by Jan Niggemann (redmine.org team member) almost 10 years ago

  • Description updated (diff)
Actions #3

Updated by Jan Niggemann (redmine.org team member) almost 10 years ago

R Sonnenberg wrote:

Sorry about messing up the formatting, I missed a closing /pre tag and cannot edit the message myself..

Fixed that for you :-)

Actions #4

Updated by Jean-Philippe Lang almost 10 years ago

  • Status changed from New to Needs feedback

This error is fixed in 2.5. You should be able to prevent that by editing your custom fields and making sure that min and max lengths are not blank. Instead, set them to 0.

Actions #5

Updated by R Sonnenberg almost 10 years ago

I just added the min/max values (0) and that fixes the problem! Thanks for the work-around; I guess this issue can be closed now?

Actions #6

Updated by Jean-Philippe Lang almost 10 years ago

  • Subject changed from Internal server error 500 when adding/editing time entry with custom field to Error when editing custom field with blank min_length or max_length
  • Status changed from Needs feedback to Closed
  • Assignee set to Jean-Philippe Lang
  • Target version set to 2.4.7
  • Resolution set to Fixed

Fix is committed in 2.4-stable (r13328), thanks for the feedback!

Actions

Also available in: Atom PDF