Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Ivlev
bugzilla
Commits
ea7030a7
Commit
ea7030a7
authored
Feb 17, 2005
by
travis%sedsystems.ca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 271276 : Cannot enter negative time for 'Hours Worked'
Patch by Shane H. W. Travis <travis@sedsystems.ca> r=LpSolit a=justdave
parent
4f8be652
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
20 deletions
+44
-20
Bug.pm
Bugzilla/Bug.pm
+21
-2
globals.pl
globals.pl
+5
-9
user-error.html.tmpl
template/en/default/global/user-error.html.tmpl
+18
-9
No files found.
Bugzilla/Bug.pm
View file @
ea7030a7
...
@@ -502,8 +502,27 @@ sub EmitDependList {
...
@@ -502,8 +502,27 @@ sub EmitDependList {
sub
ValidateTime
{
sub
ValidateTime
{
my
(
$time
,
$field
)
=
@_
;
my
(
$time
,
$field
)
=
@_
;
if
(
$time
>
99999.99
||
$time
<
0
||
!
(
$time
=~
/^(?:\d+(?:\.\d*)?|\.\d+)$/
))
{
ThrowUserError
(
"need_positive_number"
,
{
field
=>
"$field"
},
"abort"
);
# regexp verifies one or more digits, optionally followed by a period and
# zero or more digits, OR we have a period followed by one or more digits
# (allow negatives, though, so people can back out errors in time reporting)
if
(
$time
!~
/^-?(?:\d+(?:\.\d*)?|\.\d+)$/
)
{
ThrowUserError
(
"number_not_numeric"
,
{
field
=>
"$field"
,
num
=>
"$time"
},
"abort"
);
}
# Only the "work_time" field is allowed to contain a negative value.
if
(
(
$time
<
0
)
&&
(
$field
ne
"work_time"
)
)
{
ThrowUserError
(
"number_too_small"
,
{
field
=>
"$field"
,
num
=>
"$time"
,
min_num
=>
"0"
},
"abort"
);
}
if
(
$time
>
99999.99
)
{
ThrowUserError
(
"number_too_large"
,
{
field
=>
"$field"
,
num
=>
"$time"
,
max_num
=>
"99999.99"
},
"abort"
);
}
}
}
}
...
...
globals.pl
View file @
ea7030a7
...
@@ -110,6 +110,11 @@ sub AppendComment {
...
@@ -110,6 +110,11 @@ sub AppendComment {
my
(
$bugid
,
$who
,
$comment
,
$isprivate
,
$timestamp
,
$work_time
)
=
@_
;
my
(
$bugid
,
$who
,
$comment
,
$isprivate
,
$timestamp
,
$work_time
)
=
@_
;
$work_time
||=
0
;
$work_time
||=
0
;
if
(
$work_time
)
{
require
Bugzilla::
Bug
;
Bugzilla::Bug::
ValidateTime
(
$work_time
,
"work_time"
);
}
# Use the date/time we were given if possible (allowing calling code
# Use the date/time we were given if possible (allowing calling code
# to synchronize the comment's timestamp with those of other records).
# to synchronize the comment's timestamp with those of other records).
$timestamp
=
(
$timestamp
?
SqlQuote
(
$timestamp
)
:
"NOW()"
);
$timestamp
=
(
$timestamp
?
SqlQuote
(
$timestamp
)
:
"NOW()"
);
...
@@ -117,15 +122,6 @@ sub AppendComment {
...
@@ -117,15 +122,6 @@ sub AppendComment {
$comment
=~
s/\r\n/\n/g
;
# Get rid of windows-style line endings.
$comment
=~
s/\r\n/\n/g
;
# Get rid of windows-style line endings.
$comment
=~
s/\r/\n/g
;
# Get rid of mac-style line endings.
$comment
=~
s/\r/\n/g
;
# Get rid of mac-style line endings.
# allowing negatives though so people can back out errors in time reporting
if
(
defined
$work_time
)
{
# regexp verifies one or more digits, optionally followed by a period and
# zero or more digits, OR we have a period followed by one or more digits
if
(
$work_time
!~
/^-?(?:\d+(?:\.\d*)?|\.\d+)$/
)
{
ThrowUserError
(
"need_numeric_value"
,
{},
"abort"
);
}
}
else
{
$work_time
=
0
};
if
(
$comment
=~
/^\s*$/
)
{
# Nothin' but whitespace
if
(
$comment
=~
/^\s*$/
)
{
# Nothin' but whitespace
return
;
return
;
}
}
...
...
template/en/default/global/user-error.html.tmpl
View file @
ea7030a7
...
@@ -715,15 +715,6 @@
...
@@ -715,15 +715,6 @@
You must specify a component to help determine the new owner of these
You must specify a component to help determine the new owner of these
[% terms.bugs %].
[% terms.bugs %].
[% ELSIF error == "need_numeric_value" %]
[% title = "Numeric Value Required" %]
Hours requires a numeric value.
[% ELSIF error == "need_positive_number" %]
[% title = "Positive Number Required" %]
The <em>[% field_descs.$field FILTER html %]</em> field requires a positive
number.
[% ELSIF error == "need_product" %]
[% ELSIF error == "need_product" %]
[% title = "Product Required" %]
[% title = "Product Required" %]
You must specify a product to help determine the new owner of these [% terms.bugs %].
You must specify a product to help determine the new owner of these [% terms.bugs %].
...
@@ -800,6 +791,24 @@
...
@@ -800,6 +791,24 @@
Either no products have been defined to enter [% terms.bugs %] against or you have not
Either no products have been defined to enter [% terms.bugs %] against or you have not
been given access to any.
been given access to any.
[% ELSIF error == "number_not_numeric" %]
[% title = "Numeric Value Required" %]
The value '[% num FILTER html %]' in the
<em>[% field_descs.$field FILTER html %]</em> field
is not a numeric value.
[% ELSIF error == "number_too_large" %]
[% title = "Number Too Large" %]
The value '[% num FILTER html %]' in the
<em>[% field_descs.$field FILTER html %]</em> field
is more than the maximum allowable value of '[% max_num FILTER html %]'.
[% ELSIF error == "number_too_small" %]
[% title = "Number Too Small" %]
The value '[% num FILTER html %]'
in the <em>[% field_descs.$field FILTER html %]</em> field
is less than the minimum allowable value of '[% min_num FILTER html %]'.
[% ELSIF error == "old_password_incorrect" %]
[% ELSIF error == "old_password_incorrect" %]
[% title = "Incorrect Old Password" %]
[% title = "Incorrect Old Password" %]
You did not enter your old password correctly.
You did not enter your old password correctly.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment