From 782d536feff3b2dce6c5f231167ed79059c161ea Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Mon, 30 Nov 2009 04:18:36 +0000 Subject: Bug 523411: Hook: product-end_of_create Patch by Dave Lawrence r=mkanat, a=mkanat --- Bugzilla/Hook.pm | 15 +++++++++++++++ Bugzilla/Product.pm | 3 +++ 2 files changed, 18 insertions(+) (limited to 'Bugzilla') diff --git a/Bugzilla/Hook.pm b/Bugzilla/Hook.pm index d29d4cf86..7ee033f86 100644 --- a/Bugzilla/Hook.pm +++ b/Bugzilla/Hook.pm @@ -656,6 +656,21 @@ to the user. (F's C) =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 - The new L object that was just created. + +=back + =head2 sanitycheck_repair This hook allows for extra sanity check repairs to be made, for use by diff --git a/Bugzilla/Product.pm b/Bugzilla/Product.pm index d6eeab123..ac2bd4d72 100644 --- a/Bugzilla/Product.pm +++ b/Bugzilla/Product.pm @@ -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; } -- cgit v1.2.1