]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 385910: Add parameter to allow "find a specific bug" to accept an empty search...
authorlpsolit%gmail.com <>
Tue, 26 Jun 2007 23:38:41 +0000 (23:38 +0000)
committerlpsolit%gmail.com <>
Tue, 26 Jun 2007 23:38:41 +0000 (23:38 +0000)
Bugzilla/Config/Query.pm
buglist.cgi
template/en/default/admin/params/query.html.tmpl
template/en/default/search/search-specific.html.tmpl

index e3996a0eef1287655e17db1442efacfbf1a7216f..afd3308989eec0d53eae246bd88e61c8ee441c7a 100644 (file)
@@ -72,7 +72,15 @@ sub get_param_list {
    type    => 't',
    default => '4',
    checker => \&check_numeric
-  } );
+  },
+  
+  {
+   name => 'quicksearch_allow_empty_words',
+   type => 'b',
+   default => 0
+  }
+  
+  );
   return @param_list;
 }
 
index a22a7484245f57890b91d800b87f85aad09c5d72..790997a06b21ef6f5653e7b24c41ff6af9e68200 100755 (executable)
@@ -74,9 +74,12 @@ if (defined($searchstring)) {
     # as if this had been a normal query from the beginning.
 }
 
-# Reject empty searches from the simple search form, including
-# words being a single or several consecutive whitespaces only.
-if (defined($cgi->param('content')) && $cgi->param('content') =~ /^\s*$/) {
+# If configured to not allow empty words, reject empty searches from the
+# simple search form, including words being a single or several consecutive
+# whitespaces only.
+if (!Bugzilla->params->{'quicksearch_allow_empty_words'}
+    && defined($cgi->param('content')) && $cgi->param('content') =~ /^\s*$/)
+{
     ThrowUserError("buglist_parameters_required");
 }
 
index ca4280f625769fb33cf2b660f080306b19310335..b3f0b0f66bece61b32c9cd3158874da0375aae65 100644 (file)
@@ -54,5 +54,7 @@
 
   quicksearch_comment_cutoff => "The maximum number of search terms for a QuickSearch " _
                                 "to search comments. If the QuickSearch query contains " _
-                                "more terms than this value, QuickSearch will not search comments." }
+                                "more terms than this value, QuickSearch will not search comments.",
+
+  quicksearch_allow_empty_words => "Whether to allow a QuickSearch with empty Words." }
 %]
index d93abd883bb33efe56821cb4878f6b4ec474f8da..af633ddf7c9c43c312287c30385d8bf1db7bba01 100644 (file)
@@ -109,12 +109,17 @@ for "crash secure SSL flash".
   <tr>
     <td></td>
     <td>
-      <input type="submit" id="search" value="Search"
+    
+      [% IF Param('quicksearch_allow_empty_words') %]
+        <input type="submit" id="search" value="Search">
+      [% ELSE %]
+        <input type="submit" id="search" value="Search"
              onclick="if (this.form.content.value == '')
                       {alert('The Words field cannot be empty. You have to ' +
                              'enter at least one word in your search criteria.');
                        return false;} return true;">
-     </td>
+      [% END %]
+    </td>
   </tr>
 </table>
 </form>