summaryrefslogtreecommitdiffstats
path: root/contrib/bug_email.pl
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2006-05-30 02:24:53 +0200
committerlpsolit%gmail.com <>2006-05-30 02:24:53 +0200
commitd8f36cac89e6e054e884cbf54fbe130ec7424f9e (patch)
tree1deb3f27119b5a11c292e430ca2ec9813b6a4346 /contrib/bug_email.pl
parent598ce63e0d2acbc3a2060fe13199742945fac342 (diff)
downloadbugzilla-d8f36cac89e6e054e884cbf54fbe130ec7424f9e.tar.gz
bugzilla-d8f36cac89e6e054e884cbf54fbe130ec7424f9e.tar.xz
Bug 337054: Remove get_component_id() and get_component_name() from globals.pl - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
Diffstat (limited to 'contrib/bug_email.pl')
-rwxr-xr-xcontrib/bug_email.pl52
1 files changed, 16 insertions, 36 deletions
diff --git a/contrib/bug_email.pl b/contrib/bug_email.pl
index 15fdaa718..141136a87 100755
--- a/contrib/bug_email.pl
+++ b/contrib/bug_email.pl
@@ -38,7 +38,7 @@
#
# You need to work with bug_email.pl the MIME::Parser installed.
#
-# $Id: bug_email.pl,v 1.34 2006/05/14 19:12:13 lpsolit%gmail.com Exp $
+# $Id: bug_email.pl,v 1.35 2006/05/29 17:24:54 lpsolit%gmail.com Exp $
###############################################################
# 02/12/2000 (SML)
@@ -96,6 +96,8 @@ use lib "../";
use Bugzilla::Constants;
use Bugzilla::BugMail;
use Bugzilla::User;
+use Bugzilla::Product;
+use Bugzilla::Component;
my @mailerrors = (); # Buffer for Errors in the mail
my @mailwarnings = (); # Buffer for Warnings found in the mail
@@ -202,34 +204,6 @@ sub CheckPermissions {
}
###############################################################
-# Check if product is valid.
-sub CheckProduct {
- my $Product = shift;
- my $dbh = Bugzilla->dbh;
- my $prod_name = $dbh->selectrow_array(q{SELECT name
- FROM products
- WHERE name = ?}, undef, $Product);
- return $prod_name || "";
-}
-
-###############################################################
-# Check if component is valid for product.
-sub CheckComponent {
- my $Product = shift;
- my $Component = shift;
- my $dbh = Bugzilla->dbh;
-
- my $comp_name = $dbh->selectrow_array(q{SELECT components.name
- FROM components
- INNER JOIN products
- ON components.product_id = products.id
- WHERE products.name= ?
- AND components.name= ?},
- undef, $Product, $Component);
- return $comp_name || "";
-}
-
-###############################################################
# Check if component is valid for product.
sub CheckVersion {
my $Product = shift;
@@ -812,10 +786,14 @@ if (Param("useqacontact")) {
# depends on the product !
# => first check product !
# Product
+my $product;
my $all_products;
# set to the default product. If the default product is empty, this has no effect
my $Product = $DEFAULT_PRODUCT;
-$Product = CheckProduct( $Control{'product'} ) if( defined( $Control{ 'product'} ));
+if (defined($Control{ 'product'})) {
+ $product = new Bugzilla::Product({'name' => $Control{'product'}});
+ $Product = $product ? $product->name : "";
+}
if ( $Product eq "" ) {
my $Text = "You didn't send a value for the required key \@product !\n\n";
@@ -843,12 +821,15 @@ $Control{'product'} = $Product;
#
# set to the default component. If the default component is empty, this has no effect
+my $component;
my $Component = $DEFAULT_COMPONENT;
-if( defined( $Control{'component' } )) {
- $Component = CheckComponent( $Control{'product'}, $Control{'component'} );
+if (defined($Control{'component'})) {
+ $component = new Bugzilla::Component({'product_id' => $product->id,
+ 'name' => $Control{'component'}});
+ $Component = $component ? $component->name : "";
}
-
+
if ( $Component eq "" ) {
my $Text = "You did not send a value for the required key \@component!\n\n";
@@ -1091,10 +1072,9 @@ END
if( $field eq "groupset" ) {
push (@values, $Control{$field});
} elsif ( $field eq 'product' ) {
- push (@values, get_product_id($Control{$field}));
+ push (@values, $product->id);
} elsif ( $field eq 'component' ) {
- push (@values, get_component_id(get_product_id($Control{'product'}),
- $Control{$field}));
+ push (@values, $component->id);
} else {
push (@values, $Control{$field});
}