Defect #19731

Issue validation fails if % done field is deactivated

Added by Dominik Brumm about 3 years ago. Updated about 3 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Issues
Target version:3.0.3
Resolution:Fixed Affected version:3.0.2

Description

Creating a new issue fails with a validation message "% done is not valid" when then field has been removed for the tracker.

Temporarely solved the problem by changing issue.rb:

  def clear_disabled_fields
    if tracker
      tracker.disabled_core_fields.each do |attribute|
        send "#{attribute}=", nil unless attribute == "done_ratio" 
      end
    end
  end
Environment:
  Redmine version                3.0.2.stable.14229
  Ruby version                   1.9.3-p484 (2013-11-22) [x86_64-linux]
  Rails version                  4.2.1
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.8.8
  Git                            1.9.1
  Filesystem
Redmine plugins:
  no plugin installed

Related issues

Related to Redmine - Defect #19777: Ticket update/create fails with "% Done is not included i... Closed

Associated revisions

Revision 14241
Added by Jean-Philippe Lang about 3 years ago

Fixed that issue validation fails if % done field is deactivated (#19731).

History

#1 Updated by Toshi MARUYAMA about 3 years ago

  • Description updated (diff)

#2 Updated by Leonel Iturralde about 3 years ago

Hi,
The done_ratio column is not null (mysql) in my database.
So, I change issue.rb this way

validates_inclusion_of :done_ratio, :in => 0..100, :if => Proc.new {|issue| issue.done_ratio=0 unless issue.disabled_core_fields.include?(:done_ratio); issue.disabled_core_fields.include?(:done_ratio)}

Hope this helps.

#3 Updated by Chris Tyler about 3 years ago

Where do you make the above edit? Does it need to be compiled?

#4 Updated by Leonel Iturralde about 3 years ago

Hi,
the change is done to the file
source:tags/3.0.2/app/models/issue.rb

My change is done on the line 71.
The change done by Dominik Brumm is on the line 1591

After changing that file, restart the server.

#5 Updated by Go MAEDA about 3 years ago

  • Related to Defect #19777: Ticket update/create fails with "% Done is not included in the list" even when this field not enabled added

#6 Updated by Jean-Philippe Lang about 3 years ago

  • Target version set to 3.0.3

#7 Updated by Jean-Philippe Lang about 3 years ago

  • Subject changed from Validation fails if % done field is deactivated to Issue validation fails if % done field is deactivated
  • Status changed from New to Resolved
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Fixed in r14241, thanks for pointing this out.

#8 Updated by Jean-Philippe Lang about 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF