]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1198659: Custom fields of type INTEGER should accept negative integers
authorFrédéric Buclin <LpSolit@gmail.com>
Wed, 26 Aug 2015 21:36:17 +0000 (23:36 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Wed, 26 Aug 2015 21:36:17 +0000 (23:36 +0200)
r=gerv a=sgreen

Bugzilla/Bug.pm
template/en/default/bug/field.html.tmpl

index dda572ed79f922a79d18913c2cb9ef3f51a341e2..bd3bf587ca128d6440fd589c78d0cc1ad4fba40a 100644 (file)
@@ -2292,7 +2292,7 @@ sub _check_integer_field {
         ThrowUserError("number_not_integer",
                        {field => $field, num => $orig_value});
     }
-    elsif ($value > MAX_INT_32) {
+    elsif (abs($value) > MAX_INT_32) {
         ThrowUserError("number_too_large",
                        {field => $field, num => $orig_value, max_num => MAX_INT_32});
     }
index 4d6019d010e0efcb589873b58eb642a0dd127a34..87725b69979cf7e2f593312a62d2d0ceecdeb172 100644 (file)
                name="[% field.name FILTER html %]"
                value="[% value FILTER html %]" size="40"
                maxlength="[% constants.MAX_FREETEXT_LENGTH FILTER none %]"
-               [% IF field.type == constants.FIELD_TYPE_INTEGER %] pattern="\d+[% IF dontchange %]|[% dontchange FILTER html %][% END %]" [% END %]
+               [% IF field.type == constants.FIELD_TYPE_INTEGER %]
+                 pattern="-?\d+[% IF dontchange %]|[% dontchange FILTER html %][% END %]"
+                 title="The value must be a valid positive or negative integer"
+               [% END %]
                [% IF field.is_mandatory %]
                  data-required="true" [% 'aria-required="true" required' UNLESS field_hidden %]
                [% END %]>