diff options
author | myk%mozilla.org <> | 2004-01-26 20:09:40 +0000 |
---|---|---|
committer | myk%mozilla.org <> | 2004-01-26 20:09:40 +0000 |
commit | c91ea0fefd6fc35e1c829cd93137ecc3d6e610aa (patch) | |
tree | 34533ce67151877a45fc10853771889304079fba /Bugzilla | |
parent | Fix for bug 232160: adds the header back in to the "verify component, etc." p... (diff) | |
download | bugzilla-c91ea0fefd6fc35e1c829cd93137ecc3d6e610aa.tar.gz bugzilla-c91ea0fefd6fc35e1c829cd93137ecc3d6e610aa.tar.bz2 bugzilla-c91ea0fefd6fc35e1c829cd93137ecc3d6e610aa.zip |
Fix for bug 232164: Adds backwards-compatibility hack for changedin queries for newly created bugs and simplifies the code.
r=bbaetz
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Search.pm | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 75cb65af6..68280b772 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -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); |