summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2011-07-18 02:32:39 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2011-07-18 02:32:39 +0200
commit2ceff04544490ec387f50ca1d406f4689d63fc6a (patch)
tree6360fad1b2c7166ba2a05c9a286b805b454e75ef
parentd56069c56d0adec39a815e7592ac868dc847afb1 (diff)
downloadbugzilla-2ceff04544490ec387f50ca1d406f4689d63fc6a.tar.gz
bugzilla-2ceff04544490ec387f50ca1d406f4689d63fc6a.tar.xz
Bug 561170: Date validations are done in the wrong order, generating unwanted warnings
r=dkl a=LpSolit
-rwxr-xr-xsummarize_time.cgi12
1 files changed, 6 insertions, 6 deletions
diff --git a/summarize_time.cgi b/summarize_time.cgi
index 6f9580ac2..dd8ba741b 100755
--- a/summarize_time.cgi
+++ b/summarize_time.cgi
@@ -264,7 +264,7 @@ $user->is_timetracker
action => "access",
object => "timetracking_summaries"});
-my @ids = split(",", $cgi->param('id'));
+my @ids = split(",", $cgi->param('id') || '');
@ids = map { Bugzilla::Bug->check($_)->id } @ids;
scalar(@ids) || ThrowUserError('no_bugs_chosen', {action => 'view'});
@@ -293,17 +293,17 @@ if ($do_report) {
$start_date = trim $cgi->param('start_date');
$end_date = trim $cgi->param('end_date');
+ foreach my $date ($start_date, $end_date) {
+ next unless $date;
+ validate_date($date)
+ || ThrowUserError('illegal_date', {date => $date, format => 'YYYY-MM-DD'});
+ }
# Swap dates in case the user put an end_date before the start_date
if ($start_date && $end_date &&
str2time($start_date) > str2time($end_date)) {
$vars->{'warn_swap_dates'} = 1;
($start_date, $end_date) = ($end_date, $start_date);
}
- foreach my $date ($start_date, $end_date) {
- next unless $date;
- validate_date($date)
- || ThrowUserError('illegal_date', {date => $date, format => 'YYYY-MM-DD'});
- }
# Store dates in a session cookie so re-visiting the page
# for other bugs keeps them around.