From b7f0500a66f2042804a7b8631436a1fec6e9ddee Mon Sep 17 00:00:00 2001 From: "jocuri%softhome.net" <> Date: Tue, 21 Feb 2006 22:52:58 +0000 Subject: [PATCH] Patch for bug 317003: change the listing of valid fields values in bug_email.pl; patch by Gabriel Sales de Oliveira , r=vladd, a=justdave. --- contrib/bug_email.pl | 43 +++++++++++++++++++------------------------ 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/contrib/bug_email.pl b/contrib/bug_email.pl index 1590387e65..67524816cd 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.28 2005/07/08 02:31:43 mkanat%kerio.com Exp $ +# $Id: bug_email.pl,v 1.28.2.1 2006/02/21 14:52:58 jocuri%softhome.net Exp $ ############################################################### # 02/12/2000 (SML) @@ -290,16 +290,11 @@ sub Reply( $$$$ ) { # prios sub getEnumList( $ ) { + my $dbh = Bugzilla->dbh; my ($fieldname) = @_; - SendSQL( "describe bugs $fieldname" ); - my ($f, $type) = FetchSQLData(); + my $result = $dbh->selectcol_arrayref(qq{SELECT value FROM $fieldname}); - # delete unneeded stuff - $type =~ s/enum\(|\)//g; - $type =~ s/\',//g; - - my @all_prios = split( /\'/, $type ); - return( @all_prios ); + return($result); } ############################################################### @@ -310,12 +305,12 @@ sub getEnumList( $ ) sub CheckPriority { my $prio = $Control{'priority'}; - my @all_prios = getEnumList( "priority" ); + my $all_prios = getEnumList( "priority" ); - if( $prio eq "" || (lsearch( \@all_prios, $prio ) == -1) ) { + if( $prio eq "" || (lsearch( $all_prios, $prio ) == -1) ) { # OK, Prio was not defined - create Answer my $Text = "You sent wrong priority-setting, valid values are:" . - join( "\n\t", @all_prios ) . "\n\n"; + join( "\n\t", @$all_prios ) . "\n\n"; $Text .= "* The priority is set to the default value ". SqlQuote( Param('defaultpriority')) . "\n"; @@ -334,12 +329,12 @@ sub CheckPriority sub CheckSeverity { my $sever = ($Control{'bug_severity'} ||= "" ); - my @all_sever = getEnumList( "bug_severity" ); + my $all_sever = getEnumList( "bug_severity" ); - if( (lsearch( \@all_sever, $sever ) == -1) || $sever eq "" ) { + if( (lsearch($all_sever, $sever) == -1) || $sever eq "" ) { # OK, Prio was not defined - create Answer my $Text = "You sent wrong bug_severity-setting, valid values are:" . - join( "\n\t", @all_sever ) . "\n\n"; + join( "\n\t", @$all_sever ) . "\n\n"; $Text .= "* The bug_severity is set to the default value ". SqlQuote( "normal" ) . "\n"; @@ -356,12 +351,12 @@ sub CheckSeverity sub CheckArea { my $area = ($Control{'area'} ||= "" ); - my @all= getEnumList( "area" ); + my $all = getEnumList( "area" ); - if( (lsearch( \@all, $area ) == -1) || $area eq "" ) { + if( (lsearch($all, $area) == -1) || $area eq "" ) { # OK, Area was not defined - create Answer my $Text = "You sent wrong area-setting, valid values are:" . - join( "\n\t", @all ) . "\n\n"; + join( "\n\t", @$all ) . "\n\n"; $Text .= "* The area is set to the default value ". SqlQuote( "BUILD" ) . "\n"; @@ -378,12 +373,12 @@ sub CheckArea sub CheckPlatform { my $platform = ($Control{'rep_platform'} ||= "" ); - my @all = getEnumList( "rep_platform" ); + my $all = getEnumList( "rep_platform" ); - if( (lsearch( \@all, $platform ) == -1) || $platform eq "" ) { + if( (lsearch($all, $platform) == -1) || $platform eq "" ) { # OK, Prio was not defined - create Answer my $Text = "You sent wrong platform-setting, valid values are:" . - join( "\n\t", @all ) . "\n\n"; + join( "\n\t", @$all ) . "\n\n"; $Text .= "* The rep_platform is set to the default value ". SqlQuote( "All" ) . "\n"; @@ -400,12 +395,12 @@ sub CheckPlatform sub CheckSystem { my $sys = ($Control{'op_sys'} ||= "" ); - my @all = getEnumList( "op_sys" ); + my $all = getEnumList( "op_sys" ); - if( (lsearch( \@all, $sys ) == -1) || $sys eq "" ) { + if( (lsearch( $all, $sys ) == -1) || $sys eq "" ) { # OK, Prio was not defined - create Answer my $Text = "You sent wrong OS-setting, valid values are:" . - join( "\n\t", @all ) . "\n\n"; + join( "\n\t", @$all ) . "\n\n"; $Text .= "* The op_sys is set to the default value ". SqlQuote( "Linux" ) . "\n"; -- 2.47.2