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
54bbf193
Commit
54bbf193
authored
Aug 22, 2008
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 437006: Add hooks to Bugzilla\Bug.pm to display additional columns
Patch By Elliotte Martin <elliotte_martin@yahoo.com> r=mkanat, a=mkanat
parent
67c886dd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
98 additions
and
2 deletions
+98
-2
Bug.pm
Bugzilla/Bug.pm
+12
-2
Hook.pm
Bugzilla/Hook.pm
+32
-0
bug-columns.pl
extensions/example/code/bug-columns.pl
+27
-0
bug-fields.pl
extensions/example/code/bug-fields.pl
+27
-0
No files found.
Bugzilla/Bug.pm
View file @
54bbf193
...
...
@@ -72,7 +72,9 @@ sub DB_COLUMNS {
my
@custom
=
grep
{
$_
->
type
!=
FIELD_TYPE_MULTI_SELECT
}
Bugzilla
->
active_custom_fields
;
my
@custom_names
=
map
{
$_
->
name
}
@custom
;
return
qw(
my
@columns
=
qw(
alias
assigned_to
bug_file_loc
...
...
@@ -101,6 +103,10 @@ sub DB_COLUMNS {
$dbh
->
sql_date_format
(
'creation_ts'
,
'%Y.%m.%d %H:%i'
)
.
' AS creation_ts'
,
$dbh
->
sql_date_format
(
'deadline'
,
'%Y-%m-%d'
)
.
' AS deadline'
,
@custom_names
;
Bugzilla::Hook::
process
(
"bug-columns"
,
{
'columns'
=>
\
@columns
}
);
return
@columns
;
}
use
constant
REQUIRED_CREATE_FIELDS
=>
qw(
...
...
@@ -1645,7 +1651,8 @@ sub _check_select_field {
sub
fields
{
my
$class
=
shift
;
return
(
my
@fields
=
(
# Standard Fields
# Keep this ordering in sync with bugzilla.dtd.
qw(bug_id alias creation_ts short_desc delta_ts
...
...
@@ -1664,6 +1671,9 @@ sub fields {
# Custom Fields
map
{
$_
->
name
}
Bugzilla
->
active_custom_fields
);
Bugzilla::Hook::
process
(
"bug-fields"
,
{
'fields'
=>
\
@fields
}
);
return
@fields
;
}
#####################################################################
...
...
Bugzilla/Hook.pm
View file @
54bbf193
...
...
@@ -207,6 +207,21 @@ This works just like L</auth-login_methods> except it's for
login verification methods (See L<Bugzilla::Auth::Verify>.) It also
takes a C<modules> parameter, just like L</auth-login_methods>.
=head2 bug-columns
This allows you to add new fields that will show up in every L<Bugzilla::Bug>
object. Note that you will also need to use the L</bug-fields> hook in
conjunction with this hook to make this work.
Params:
=over
=item C<columns> - An arrayref containing an array of column names. Push
your column name(s) onto the array.
=back
=head2 bug-end_of_update
This happens at the end of L<Bugzilla::Bug/update>, after all other changes are
...
...
@@ -226,6 +241,23 @@ C<$changes-E<gt>{field} = [old, new]>
=back
=head2 bug-fields
Allows the addition of database fields from the bugs table to the standard
list of allowable fields in a L<Bugzilla::Bug> object, so that
you can call the field as a method.
Note: You should add here the names of any fields you added in L</bug-columns>.
Params:
=over
=item C<columns> - A arrayref containing an array of column names. Push
your column name(s) onto the array.
=back
=head2 buglist-columns
This happens in buglist.cgi after the standard columns have been defined and
...
...
extensions/example/code/bug-columns.pl
0 → 100644
View file @
54bbf193
# -*- Mode: perl; indent-tabs-mode: nil -*-
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Example Plugin.
#
# The Initial Developer of the Original Code is Canonical Ltd.
# Portions created by Canonical Ltd. are Copyright (C) 2008
# Canonical Ltd. All Rights Reserved.
#
# Contributor(s): Elliotte Martin <elliotte_martin@yahoo.com>
use
strict
;
use
warnings
;
use
Bugzilla
;
my
$columns
=
Bugzilla
->
hook_args
->
{
'columns'
};
push
(
@$columns
,
"delta_ts AS example"
)
extensions/example/code/bug-fields.pl
0 → 100644
View file @
54bbf193
# -*- Mode: perl; indent-tabs-mode: nil -*-
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Example Plugin.
#
# The Initial Developer of the Original Code is Canonical Ltd.
# Portions created by Canonical Ltd. are Copyright (C) 2008
# Canonical Ltd. All Rights Reserved.
#
# Contributor(s): Elliotte Martin <elliotte_martin@yahoo.com>
use
strict
;
use
warnings
;
use
Bugzilla
;
my
$fields
=
Bugzilla
->
hook_args
->
{
'fields'
};
push
(
@$fields
,
"example"
)
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