diff options
author | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-07-14 06:40:15 +0200 |
---|---|---|
committer | Max Kanat-Alexander <mkanat@bugzilla.org> | 2010-07-14 06:40:15 +0200 |
commit | 3dc3a0158176502be828ce48405f0c99096a5e18 (patch) | |
tree | f2573587db44b2cac203dbed63e0b079b9de1c77 /Bugzilla | |
parent | 110186aafbb660ad8d1d9fde8d41b794a79b75d9 (diff) | |
download | bugzilla-3dc3a0158176502be828ce48405f0c99096a5e18.tar.gz bugzilla-3dc3a0158176502be828ce48405f0c99096a5e18.tar.xz |
Bug 578594: Search.pm: Move deadlinefrom and deadlineto parsing into a
special method
r=mkanat, a=mkanat (module owner)
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Search.pm | 50 |
1 files changed, 17 insertions, 33 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 9e5f658a8..fe252033e 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -728,6 +728,7 @@ sub _parse_params { my @charts = $self->_parse_basic_fields(); push(@charts, $self->_special_parse_email()); push(@charts, $self->_special_parse_chfield()); + push(@charts, $self->_special_parse_deadline()); return @charts; } @@ -874,6 +875,22 @@ sub _special_parse_chfield { return @charts; } +sub _special_parse_deadline { + my ($self) = @_; + return if !Bugzilla->user->is_timetracker; + my $params = $self->_params; + + my @charts; + if (my $from = $params->param('deadlinefrom')) { + push(@charts, ['deadline', 'greaterthaneq', $from]); + } + if (my $to = $params->param('deadlineto')) { + push(@charts, ['deadline', 'lessthaneq', $to]); + } + + return @charts; +} + sub _special_parse_email { my ($self) = @_; my $params = $self->_params; @@ -1022,39 +1039,6 @@ sub init { my @specialchart = $self->_parse_params(); - my $sql_deadlinefrom; - my $sql_deadlineto; - if ($user->is_timetracker) { - my $deadlinefrom; - my $deadlineto; - - if ($params->param('deadlinefrom')){ - $params->param('deadlinefrom', '') if lc($params->param('deadlinefrom')) eq 'now'; - $deadlinefrom = SqlifyDate($params->param('deadlinefrom')); - $sql_deadlinefrom = $dbh->quote($deadlinefrom); - trick_taint($sql_deadlinefrom); - my $term = "bugs.deadline >= $sql_deadlinefrom"; - push(@wherepart, $term); - $self->search_description({ - field => 'deadline', type => 'greaterthaneq', - value => $deadlinefrom, term => $term, - }); - } - - if ($params->param('deadlineto')){ - $params->param('deadlineto', '') if lc($params->param('deadlineto')) eq 'now'; - $deadlineto = SqlifyDate($params->param('deadlineto')); - $sql_deadlineto = $dbh->quote($deadlineto); - trick_taint($sql_deadlineto); - my $term = "bugs.deadline <= $sql_deadlineto"; - push(@wherepart, $term); - $self->search_description({ - field => 'deadline', type => 'lessthaneq', - value => $deadlineto, term => $term, - }); - } - } - foreach my $f ("short_desc", "longdesc", "bug_file_loc", "status_whiteboard") { if (defined $params->param($f)) { |