Commit 2ceff045 authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 561170: Date validations are done in the wrong order, generating unwanted warnings

r=dkl a=LpSolit
parent d56069c5
...@@ -264,7 +264,7 @@ $user->is_timetracker ...@@ -264,7 +264,7 @@ $user->is_timetracker
action => "access", action => "access",
object => "timetracking_summaries"}); object => "timetracking_summaries"});
my @ids = split(",", $cgi->param('id')); my @ids = split(",", $cgi->param('id') || '');
@ids = map { Bugzilla::Bug->check($_)->id } @ids; @ids = map { Bugzilla::Bug->check($_)->id } @ids;
scalar(@ids) || ThrowUserError('no_bugs_chosen', {action => 'view'}); scalar(@ids) || ThrowUserError('no_bugs_chosen', {action => 'view'});
...@@ -293,17 +293,17 @@ if ($do_report) { ...@@ -293,17 +293,17 @@ if ($do_report) {
$start_date = trim $cgi->param('start_date'); $start_date = trim $cgi->param('start_date');
$end_date = trim $cgi->param('end_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 # Swap dates in case the user put an end_date before the start_date
if ($start_date && $end_date && if ($start_date && $end_date &&
str2time($start_date) > str2time($end_date)) { str2time($start_date) > str2time($end_date)) {
$vars->{'warn_swap_dates'} = 1; $vars->{'warn_swap_dates'} = 1;
($start_date, $end_date) = ($end_date, $start_date); ($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 # Store dates in a session cookie so re-visiting the page
# for other bugs keeps them around. # for other bugs keeps them around.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment