Fix for bug 232164: Adds backwards-compatibility hack for changedin queries for newly created bugs and simplifies the code.

r=bbaetz


git-svn-id: svn://10.0.0.236/trunk@151843 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
myk%mozilla.org
2004-01-26 12:09:40 +00:00
parent a6770c99c6
commit f4d5a1d8b8

View File

@@ -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
# to process it because it will appear in stored queries and bookmarks.
my $changedin = $params->param('changedin') || '';
$changedin = trim($changedin);
my $changedin = trim($params->param('changedin')) || '';
if ($changedin) {
if ($changedin !~ /^[0-9]*$/) {
ThrowUserError("illegal_changed_in_last_x_days",
{ value => $changedin });
}
push(@specialchart, ["changedin", "lessthan", $changedin + 1]);
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]);
}
}
my $chfieldfrom = $params->param('chfieldfrom') || '';
my $chfieldto = $params->param('chfieldto') || '';
my @chfield = $params->param('chfield');
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)) :'';
if ($chfieldfrom ne '' || $chfieldto ne '') {
my $sql_chfrom = $chfieldfrom ? &::SqlQuote(SqlifyDate($chfieldfrom)):'';
my $sql_chto = $chfieldto ? &::SqlQuote(SqlifyDate($chfieldto)) :'';
my $sql_chvalue = $chvalue ne '' ? &::SqlQuote($chvalue) : '';
if(!@chfield) {
push(@wherepart, "bugs.delta_ts >= $sql_chfrom") if ($sql_chfrom);