From 4e4dfab33df60ecb6a529999b8900f4dc19d9b91 Mon Sep 17 00:00:00 2001 From: rojanu Date: Tue, 10 Apr 2012 20:36:46 +0200 Subject: Bug 743991: Need a new hook to update Bugzilla::Search::COLUMN_JOINS r/a=LpSolit --- Bugzilla/Search.pm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'Bugzilla/Search.pm') diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 5fe88a4f2..03242ae83 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -959,7 +959,8 @@ sub _column_join { my ($self, $field) = @_; # The _realname fields require the same join as the username fields. $field =~ s/_realname$//; - my $join_info = COLUMN_JOINS->{$field}; + my $column_joins = $self->_get_column_joins(); + my $join_info = $column_joins->{$field}; if ($join_info) { # Don't allow callers to modify the constant. $join_info = dclone($join_info); @@ -1797,6 +1798,20 @@ sub _get_operator_field_override { return $cache->{operator_field_override}; } +sub _get_column_joins { + my $self = shift; + my $cache = Bugzilla->request_cache; + + return $cache->{column_joins} if defined $cache->{column_joins}; + + my %column_joins = %{ COLUMN_JOINS() }; + Bugzilla::Hook::process('buglist_column_joins', + { column_joins => \%column_joins }); + + $cache->{column_joins} = \%column_joins; + return $cache->{column_joins}; +} + ########################### # Search Function Helpers # ########################### -- cgit v1.2.3-24-g4f1b From 8169d04e9c85cde59e030bfb665f5e1c065e9c1a Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Thu, 12 Apr 2012 20:44:59 +0200 Subject: Bug 737436: Relative dates do not work correctly with the deadline field r=dkl a=LpSolit --- Bugzilla/Search.pm | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'Bugzilla/Search.pm') diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 03242ae83..2ea4b1ae1 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -1924,16 +1924,22 @@ sub _timestamp_translate { my $value = $args->{value}; my $dbh = Bugzilla->dbh; - return if $value !~ /^[\+\-]?\d+[hdwmy]s?$/i; - - $args->{value} = SqlifyDate($value); - $args->{quoted} = $dbh->quote($args->{value}); + return if $value !~ /^(?:[\+\-]?\d+[hdwmy]s?|now)$/i; + + # By default, the time is appended to the date, which we don't want + # for deadlines. + $value = SqlifyDate($value); + if ($args->{field} eq 'deadline') { + ($value) = split(/\s/, $value); + } + $args->{value} = $value; + $args->{quoted} = $dbh->quote($value); } sub SqlifyDate { my ($str) = @_; my $fmt = "%Y-%m-%d %H:%M:%S"; - $str = "" if !defined $str; + $str = "" if (!defined $str || lc($str) eq 'now'); if ($str eq "") { my ($sec, $min, $hour, $mday, $month, $year, $wday) = localtime(time()); return sprintf("%4d-%02d-%02d 00:00:00", $year+1900, $month+1, $mday); -- cgit v1.2.3-24-g4f1b From 1d125667d33ac6542562be663930d72eec8e03b7 Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Tue, 17 Apr 2012 20:41:05 +0200 Subject: Bug 745320: Shared queries do not work when tags are part of the query r=dkl a=LpSolit --- Bugzilla/Search.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Bugzilla/Search.pm') diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 2ea4b1ae1..1097b32dd 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -792,8 +792,8 @@ sub _param_array { } sub _params { $_[0]->{params} } - sub _user { return $_[0]->{user} } +sub _sharer_id { $_[0]->{sharer} } ############################## # Internal Accessors: SELECT # @@ -2567,8 +2567,8 @@ sub _multiselect_table { } elsif ($field eq 'tag') { $args->{full_field} = 'tag.name'; - return "bug_tag INNER JOIN tag ON bug_tag.tag_id = tag.id" - . " AND user_id = " . $self->_user->id; + return "bug_tag INNER JOIN tag ON bug_tag.tag_id = tag.id AND user_id = " + . ($self->_sharer_id || $self->_user->id); } elsif ($field eq 'bug_group') { $args->{full_field} = 'groups.name'; -- cgit v1.2.3-24-g4f1b