Defect #18781

Redmine::FieldFormat::IntFormat does not accept "real" Integer values

Added by Sascha Hübner over 3 years ago. Updated over 3 years ago.

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

0%

Category:Code cleanup/refactoring
Target version:3.0.0
Resolution:Fixed Affected version:2.5.1

Description

I had the Problem of setting the value of a custom field in my code
and therefore validating the new (calculated) value.
The CustomField had the format Redmine::FieldFormat::IntFormat.
The new value was a true Integer: 1
But the value was refused with the message that it's not a Number!

The Reason is, that Redmine::FieldFormat::IntFormat validates the value with RegExp:

value =~ /^[+-]?\d+$/

which will not return true if value is not a String.
I understand, that "normally" values of custom fields will be set via forms
and so usually all values will be Strings.

But I think IntFormat's validation should accept real Integers also!

Associated revisions

Revision 13863
Added by Jean-Philippe Lang over 3 years ago

Fixed: Redmine::FieldFormat::IntFormat does not accept "real" Integer values (#18781).

History

#1 Updated by Jean-Philippe Lang over 3 years ago

  • Target version set to 3.0.0

#2 Updated by Jean-Philippe Lang over 3 years ago

  • Category set to Code cleanup/refactoring
  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Fixed in r13863.

Also available in: Atom PDF