]> 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:37:28 +0000 (23:37 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Wed, 26 Aug 2015 21:37:28 +0000 (23:37 +0200)
r=gerv a=sgreen

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

index 25f74d5f3d1f565d4b1b2420e12725b5f4ef0eec..34bf95ff7fa4672f8550140641cb4738512ec55e 100644 (file)
@@ -2259,7 +2259,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 1eceaf74c83c5e00c3abe1ce369a2cfca5fa0e39..cdf15fbd850521f45d3e730f4f01a897bbe6a3e4 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 %]>