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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
782d536f
Commit
782d536f
authored
Nov 30, 2009
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 523411: Hook: product-end_of_create
Patch by Dave Lawrence <dkl@redhat.com> r=mkanat, a=mkanat
parent
65f8c60d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
0 deletions
+61
-0
Hook.pm
Bugzilla/Hook.pm
+15
-0
Product.pm
Bugzilla/Product.pm
+3
-0
Extension.pm
extensions/Example/Extension.pm
+43
-0
No files found.
Bugzilla/Hook.pm
View file @
782d536f
...
...
@@ -656,6 +656,21 @@ to the user. (F<sanitycheck.cgi>'s C<Status>)
=back
=head2 product_end_of_create
Called right after a new product has been created, allowing additional
changes to be made to the new product's attributes. This occurs inside of
a database transaction, so if the hook throws an error all previous
changes will be rolled back including the creation of the new product.
Params:
=over
=item C<product> - The new L<Bugzilla::Product> object that was just created.
=back
=head2 sanitycheck_repair
This hook allows for extra sanity check repairs to be made, for use by
...
...
Bugzilla/Product.pm
View file @
782d536f
...
...
@@ -30,6 +30,7 @@ use Bugzilla::Status;
use
Bugzilla::Install::
Requirements
;
use
Bugzilla::
Mailer
;
use
Bugzilla::
Series
;
use
Bugzilla::
Hook
;
# Currently, we only implement enough of the Bugzilla::Field::Choice
# interface to control the visibility of other fields.
...
...
@@ -123,6 +124,8 @@ sub create {
$product
->
_create_bug_group
()
if
Bugzilla
->
params
->
{
'makeproductgroups'
};
$product
->
_create_series
()
if
$create_series
;
Bugzilla::Hook::
process
(
'product_end_of_create'
,
{
product
=>
$product
});
$dbh
->
bz_commit_transaction
();
return
$product
;
}
...
...
extensions/Example/Extension.pm
View file @
782d536f
...
...
@@ -24,6 +24,9 @@ package Bugzilla::Extension::Example;
use
strict
;
use
base
qw(Bugzilla::Extension)
;
use
Bugzilla::
Constants
;
use
Bugzilla::
Group
;
use
Bugzilla::
User
;
use
Bugzilla::
Util
qw(diff_arrays html_quote)
;
# This is extensions/Example/lib/Util.pm. I can load this here in my
...
...
@@ -346,6 +349,46 @@ sub product_confirm_delete {
$vars
->
{
'example'
}
=
1
;
}
sub
product_end_of_create
{
my
(
$self
,
$args
)
=
@_
;
my
$product
=
$args
->
{
product
};
# For this example, any lines of code that actually make changes to your
# database have been commented out.
# This section will take a group that exists in your installation
# (possible called test_group) and automatically makes the new
# product hidden to only members of the group. Just remove
# the restriction if you want the new product to be public.
my
$example_group
=
new
Bugzilla::
Group
({
name
=>
'example_group'
});
if
(
$example_group
)
{
$product
->
set_group_controls
(
$example_group
,
{
entry
=>
1
,
membercontrol
=>
CONTROLMAPMANDATORY
,
othercontrol
=>
CONTROLMAPMANDATORY
});
# $product->update();
}
# This section will automatically add a default component
# to the new product called 'No Component'.
my
$default_assignee
=
new
Bugzilla::
User
(
{
name
=>
Bugzilla
->
params
->
{
maintainer
}
});
if
(
$default_assignee
)
{
# Bugzilla::Component->create(
# { name => 'No Component',
# product => $product,
# description => 'Select this component if one does not ' .
# 'exist in the current list of components',
# initialowner => $default_assignee });
}
}
sub
sanitycheck_check
{
my
(
$self
,
$args
)
=
@_
;
...
...
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