Commit c91ea0fe authored by myk%mozilla.org's avatar myk%mozilla.org

Fix for bug 232164: Adds backwards-compatibility hack for changedin queries for…

Fix for bug 232164: Adds backwards-compatibility hack for changedin queries for newly created bugs and simplifies the code. r=bbaetz
parent 4543472f
...@@ -225,31 +225,42 @@ sub init { ...@@ -225,31 +225,42 @@ sub init {
} }
} }
my $chfieldfrom = trim(lc($params->param('chfieldfrom'))) || '';
my $chfieldto = trim(lc($params->param('chfieldto'))) || '';
$chfieldfrom = '' if ($chfieldfrom eq 'now');
$chfieldto = '' if ($chfieldto eq 'now');
my @chfield = $params->param('chfield');
my $chvalue = trim($params->param('chfieldvalue')) || '';
# 2003-05-20: The 'changedin' field is no longer in the UI, but we continue # 2003-05-20: The 'changedin' field is no longer in the UI, but we continue
# to process it because it will appear in stored queries and bookmarks. # to process it because it will appear in stored queries and bookmarks.
my $changedin = $params->param('changedin') || ''; my $changedin = trim($params->param('changedin')) || '';
$changedin = trim($changedin);
if ($changedin) { if ($changedin) {
if ($changedin !~ /^[0-9]*$/) { if ($changedin !~ /^[0-9]*$/) {
ThrowUserError("illegal_changed_in_last_x_days", ThrowUserError("illegal_changed_in_last_x_days",
{ value => $changedin }); { value => $changedin });
} }
if (!$chfieldfrom
&& !$chfieldto
&& scalar(@chfield) == 1
&& $chfield[0] eq "[Bug creation]")
{
# Deal with the special case where the query is using changedin
# to get bugs created in the last n days by converting the value
# into its equivalent for the chfieldfrom parameter.
$chfieldfrom = "-" . ($changedin - 1) . "d";
}
else {
# Oh boy, the general case. Who knows why the user included
# the changedin parameter, but do our best to comply.
push(@specialchart, ["changedin", "lessthan", $changedin + 1]); push(@specialchart, ["changedin", "lessthan", $changedin + 1]);
} }
}
my $chfieldfrom = $params->param('chfieldfrom') || ''; if ($chfieldfrom ne '' || $chfieldto ne '') {
my $chfieldto = $params->param('chfieldto') || ''; my $sql_chfrom = $chfieldfrom ? &::SqlQuote(SqlifyDate($chfieldfrom)):'';
my @chfield = $params->param('chfield'); my $sql_chto = $chfieldto ? &::SqlQuote(SqlifyDate($chfieldto)) :'';
my $chvalue = $params->param('chfieldvalue') || '';
my $lcchfieldfrom = trim(lc($chfieldfrom));
my $lcchfieldto = trim(lc($chfieldto));
$chvalue = trim($chvalue);
$lcchfieldfrom = '' if ($lcchfieldfrom eq 'now');
$lcchfieldto = '' if ($lcchfieldto eq 'now');
if ($lcchfieldfrom ne '' || $lcchfieldto ne '') {
my $sql_chfrom = $lcchfieldfrom ? &::SqlQuote(SqlifyDate($lcchfieldfrom)):'';
my $sql_chto = $lcchfieldto ? &::SqlQuote(SqlifyDate($lcchfieldto)) :'';
my $sql_chvalue = $chvalue ne '' ? &::SqlQuote($chvalue) : ''; my $sql_chvalue = $chvalue ne '' ? &::SqlQuote($chvalue) : '';
if(!@chfield) { if(!@chfield) {
push(@wherepart, "bugs.delta_ts >= $sql_chfrom") if ($sql_chfrom); push(@wherepart, "bugs.delta_ts >= $sql_chfrom") if ($sql_chfrom);
......
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