Closed
Bug 252159
Opened 20 years ago
Closed 20 years ago
centralize time validation
Categories
(Bugzilla :: Bugzilla-General, defect)
Bugzilla
Bugzilla-General
Tracking
()
RESOLVED
FIXED
Bugzilla 2.20
People
(Reporter: michetti, Assigned: michetti)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 4 obsolete files)
3.40 KB,
patch
|
kiko
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a2) Gecko/20040612 Firefox/0.8.0+
Build Identifier:
maybe is a good idea to centralize the validation of time fields such as worked
time or estimated time in a function
Reproducible: Always
Steps to Reproduce:
Comment 1•20 years ago
|
||
Yeah, there's code at least in two places in process_bug.cgi -- it's easy to
find it, just grep for 99999.99 -- agh :-P
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Comment 2•20 years ago
|
||
Comment 3•20 years ago
|
||
Comment on attachment 153804 [details] [diff] [review]
implements validateTime to centralize time validation
>Index: post_bug.cgi
Bugzilla::Bug::validateTime($est_time,'estimated_time');
[nit] space after the comma
>Index: process_bug.cgi
Bugzilla::Bug::validateTime($er_time,$field);
[ditto]
>Index: Bugzilla/Bug.pm
> 1;
>+
>+sub validateTime{
>+ my ($time,$field) = @_;
>+ if ($time > 99999.99 || $time < 0 || !($time =~ /^(?:\d+(?:\.\d*)?|\.\d+)$/)){
>+ ThrowUserError("need_positive_number",{field => "$field"});
>+ }
>+}
This function should be named ValidateTime (it's not a method, so it uses this
weird casing that EmitDependList does, I guess). It should also appear *before*
the 1; up there -- right before AUTOLOAD, to be precise.
Attachment #153804 -
Flags: review-
Updated•20 years ago
|
Assignee: justdave → michetti
Assignee | ||
Comment 4•20 years ago
|
||
Assignee | ||
Updated•20 years ago
|
Attachment #153804 -
Attachment is obsolete: true
Assignee | ||
Comment 5•20 years ago
|
||
Attachment #153808 -
Attachment is obsolete: true
Comment 6•20 years ago
|
||
Comment on attachment 153812 [details] [diff] [review]
no tabs
>Index: process_bug.cgi
>+ Bugzilla::Bug::validateTime($::FORM{'work_time'},'work_time');
Please test and read short patches before attaching, you forgot to update this
call :-)
Attachment #153812 -
Flags: review-
Assignee | ||
Comment 7•20 years ago
|
||
Attachment #153812 -
Attachment is obsolete: true
Comment 8•20 years ago
|
||
Comment on attachment 153839 [details] [diff] [review]
again
>Index: process_bug.cgi
>+ Bugzilla::Bug::validateTime($::FORM{'work_time'},
'work_time');
No, not the space after the comma (or that too), but the method name:
ValidateTime, not validateTime.
Attachment #153839 -
Flags: review-
Assignee | ||
Comment 9•20 years ago
|
||
Attachment #153839 -
Attachment is obsolete: true
Comment 10•20 years ago
|
||
Comment on attachment 153900 [details] [diff] [review]
...
Looks good!
Attachment #153900 -
Flags: review+
Updated•20 years ago
|
Status: NEW → ASSIGNED
Flags: approval?
Updated•20 years ago
|
Flags: approval? → approval+
OS: Linux → All
Hardware: PC → All
Target Milestone: --- → Bugzilla 2.20
Comment 11•20 years ago
|
||
/cvsroot/mozilla/webtools/bugzilla/post_bug.cgi,v <-- post_bug.cgi
new revision: 1.90; previous revision: 1.89
/cvsroot/mozilla/webtools/bugzilla/process_bug.cgi,v <-- process_bug.cgi
new revision: 1.208; previous revision: 1.207
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Bug.pm,v <-- Bug.pm
new revision: 1.38; previous revision: 1.37
Thanks!
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Comment 12•20 years ago
|
||
Note that the patch checked in included an "abort" to the ThrowUserError call,
which was missing in any case from the original code -- when validating work
time the table lock is held.
Updated•12 years ago
|
QA Contact: matty_is_a_geek → default-qa
You need to log in
before you can comment on or make changes to this bug.
Description
•