From 28fa2f54b2c400ff2067a7e76f1af5f7d361908b Mon Sep 17 00:00:00 2001 From: "kiko%async.com.br" <> Date: Fri, 23 Jul 2004 00:48:37 +0000 Subject: Fix for bug 252159: centralize time validation. Adds a ValidateTime function to Bugzilla::Bug and uses it in relevant callsites. Patch by Alexandre Michetti Manduca . r=kiko, a=justdave. --- Bugzilla/Bug.pm | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'Bugzilla') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index f1a1cf341..a09e7a906 100755 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -42,6 +42,7 @@ use Bugzilla::Flag; use Bugzilla::FlagType; use Bugzilla::User; use Bugzilla::Util; +use Bugzilla::Error; sub fields { # Keep this ordering in sync with bugzilla.dtd @@ -489,6 +490,13 @@ sub EmitDependList { return @list; } +sub ValidateTime{ + my ($time, $field) = @_; + if ($time > 99999.99 || $time < 0 || !($time =~ /^(?:\d+(?:\.\d*)?|\.\d+)$/)){ + ThrowUserError("need_positive_number", {field => "$field"}, 1); + } + } + sub AUTOLOAD { use vars qw($AUTOLOAD); my $attr = $AUTOLOAD; -- cgit v1.2.3-24-g4f1b