Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Ivlev
bugzilla
Commits
b4fee2c3
Commit
b4fee2c3
authored
Apr 10, 2012
by
rojanu
Committed by
Frédéric Buclin
Apr 10, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 743991: Need a new hook to update Bugzilla::Search::COLUMN_JOINS
r/a=LpSolit
parent
4b18c781
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
1 deletion
+67
-1
Hook.pm
Bugzilla/Hook.pm
+35
-0
Search.pm
Bugzilla/Search.pm
+16
-1
Extension.pm
extensions/Example/Extension.pm
+16
-0
No files found.
Bugzilla/Hook.pm
View file @
b4fee2c3
...
...
@@ -432,6 +432,41 @@ The definition is structured as:
=back
=head2 buglist_column_joins
This allows you to join additional tables to display additional columns
in buglists. This hook is generally used in combination with the
C<buglist_columns> hook.
Params:
=over
=item C<column_joins> - A hashref containing data to return back to
L<Bugzilla::Search>. This hashref contains names of the columns as keys and
a hashref about table to join as values. This hashref has the following keys:
=over
=item C<table> - The name of the additional table to join.
=item C<as> - (optional) The alias used for the additional table. This alias
must not conflict with an existing alias already used in the query.
=item C<from> - (optional) The name of the column in the C<bugs> table which
the additional table should be linked to. If omitted, C<bug_id> will be used.
=item C<to> - (optional) The name of the column in the additional table which
should be linked to the column in the C<bugs> table, see C<from> above.
If omitted, C<bug_id> will be used.
=item C<join> - (optional) Either INNER or LEFT. Determine how the additional
table should be joined with the C<bugs> table. If omitted, LEFT is used.
=back
=back
=head2 search_operator_field_override
This allows you to modify L<Bugzilla::Search/OPERATOR_FIELD_OVERRIDE>,
...
...
Bugzilla/Search.pm
View file @
b4fee2c3
...
...
@@ -971,7 +971,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
);
...
...
@@ -1809,6 +1810,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 #
###########################
...
...
extensions/Example/Extension.pm
View file @
b4fee2c3
...
...
@@ -181,6 +181,22 @@ sub buglist_columns {
my
$columns
=
$args
->
{
'columns'
};
$columns
->
{
'example'
}
=
{
'name'
=>
'bugs.delta_ts'
,
'title'
=>
'Example'
};
$columns
->
{
'product_desc'
}
=
{
'name'
=>
'prod_desc.description'
,
'title'
=>
'Product Description'
};
}
sub
buglist_column_joins
{
my
(
$self
,
$args
)
=
@_
;
my
$joins
=
$args
->
{
'column_joins'
};
# This column is added using the "buglist_columns" hook
$joins
->
{
'product_desc'
}
=
{
from
=>
'product_id'
,
to
=>
'id'
,
table
=>
'products'
,
as
=>
'prod_desc'
,
join
=>
'INNER'
,
};
}
sub
search_operator_field_override
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment