From: Frédéric Buclin Date: Wed, 26 Aug 2015 21:36:17 +0000 (+0200) Subject: Bug 1198659: Custom fields of type INTEGER should accept negative integers X-Git-Tag: release-5.1.1~179 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=48649030bf8536d8b9cf9df522c39438a06ec56c;p=thirdparty%2Fbugzilla.git Bug 1198659: Custom fields of type INTEGER should accept negative integers r=gerv a=sgreen --- diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index dda572ed79..bd3bf587ca 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -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}); } diff --git a/template/en/default/bug/field.html.tmpl b/template/en/default/bug/field.html.tmpl index 4d6019d010..87725b6997 100644 --- a/template/en/default/bug/field.html.tmpl +++ b/template/en/default/bug/field.html.tmpl @@ -42,7 +42,10 @@ 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 %]>