]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 276840 : Move $::defaultqueryname out of globals.pl into Bugzilla/Constants.pm
authortravis%sedsystems.ca <>
Wed, 19 Jan 2005 00:53:50 +0000 (00:53 +0000)
committertravis%sedsystems.ca <>
Wed, 19 Jan 2005 00:53:50 +0000 (00:53 +0000)
Patch by Max K-A <mkanat@kerio.com>    r=vladd    a=justdave

Bugzilla/Constants.pm
buglist.cgi
globals.pl
query.cgi

index 7e22ed2f7305046cdd2dbe32c53e4418fdb4c9cc..768b0e684373deca8b0b84945d6449a0efe2dc11 100644 (file)
@@ -63,6 +63,7 @@ use base qw(Exporter);
     GROUP_VISIBLE
 
     DEFAULT_COLUMN_LIST
+    DEFAULT_QUERY_NAME
 );
 
 @Bugzilla::Constants::EXPORT_OK = qw(contenttypes);
@@ -207,4 +208,8 @@ use constant DEFAULT_COLUMN_LIST => (
     "bug_status", "resolution", "short_short_desc"
 );
 
+# Used by query.cgi and buglist.cgi as the named-query name
+# for the default settings.
+use constant DEFAULT_QUERY_NAME => '(Default query)';
+
 1;
index 6df402781e394ddaecfaab487fa54343affefe2e..8abfc6869104230f197a42de3b5e74993d380b5d 100755 (executable)
@@ -44,7 +44,6 @@ require "CGI.pl";
 
 use vars qw($db_name
             @components
-            $defaultqueryname
             @legal_keywords
             @legal_platform
             @legal_priority
@@ -340,7 +339,7 @@ elsif (($::FORM{'cmdtype'} eq "doit") && $::FORM{'remtype'}) {
     if ($::FORM{'remtype'} eq "asdefault") {
         Bugzilla->login(LOGIN_REQUIRED);
         my $userid = Bugzilla->user->id;
-        my $qname = SqlQuote($::defaultqueryname);
+        my $qname = SqlQuote(DEFAULT_QUERY_NAME);
         my $qbuffer = SqlQuote($::buffer);
 
         SendSQL("LOCK TABLES namedqueries WRITE");
index 095ada57d6a77c5f42afeb6e68308169ecb26f8b..5c7da1a158fd488baaf67e6c33a29ddd9b26819b 100644 (file)
@@ -41,7 +41,6 @@ use Bugzilla::BugMail;
 sub globals_pl_sillyness {
     my $zz;
     $zz = @main::default_column_list;
-    $zz = $main::defaultqueryname;
     $zz = @main::enterable_products;
     $zz = %main::keywordsbyname;
     $zz = @main::legal_bug_status;
@@ -95,7 +94,6 @@ $::ENV{'PATH'} = '';
 $::SIG{TERM} = 'IGNORE';
 $::SIG{PIPE} = 'IGNORE';
 
-$::defaultqueryname = "(Default query)"; # This string not exposed in UI
 $::unconfirmedstate = "UNCONFIRMED";
 
 # The following subroutine is for debugging purposes only.
index 0faf156cb42e69f9df7d4352caa6659e365b7c7f..2de7e1727cfd8ef0b2e68ce60cba781b3ada0865 100755 (executable)
--- a/query.cgi
+++ b/query.cgi
@@ -76,7 +76,7 @@ if ($userid) {
         }
     }
     if (defined $cgi->cookie('DEFAULTQUERY')) {
-        push(@oldquerycookies, [$::defaultqueryname, 'DEFAULTQUERY',
+        push(@oldquerycookies, [DEFAULT_QUERY_NAME, 'DEFAULTQUERY',
                                 $cgi->cookie('DEFAULTQUERY')]);
     }
     if (@oldquerycookies) {
@@ -104,7 +104,7 @@ if ($userid) {
 if ($::FORM{'nukedefaultquery'}) {
     if ($userid) {
         SendSQL("DELETE FROM namedqueries " .
-                "WHERE userid = $userid AND name = '$::defaultqueryname'");
+                "WHERE userid = $userid AND name = " . SqlQuote(DEFAULT_QUERY_NAME));
     }
     $::buffer = "";
 }
@@ -112,7 +112,7 @@ if ($::FORM{'nukedefaultquery'}) {
 my $userdefaultquery;
 if ($userid) {
     SendSQL("SELECT query FROM namedqueries " .
-            "WHERE userid = $userid AND name = '$::defaultqueryname'");
+            "WHERE userid = $userid AND name = " . SqlQuote(DEFAULT_QUERY_NAME));
     $userdefaultquery = FetchOneColumn();
 }
 
@@ -391,7 +391,7 @@ $default{'charts'} = \@charts;
 if ($userid) {
     my @namedqueries;
     SendSQL("SELECT name FROM namedqueries " .
-            "WHERE userid = $userid AND name != '$::defaultqueryname' " .
+            "WHERE userid = $userid AND name != " . SqlQuote(DEFAULT_QUERY_NAME) .
             "ORDER BY name");
     while (MoreSQLData()) {
         push(@namedqueries, FetchOneColumn());