]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 184081 Change search interfaces to use Viewable products instead of enterable...
authorbugreport%peshkin.net <>
Tue, 10 Dec 2002 22:17:02 +0000 (22:17 +0000)
committerbugreport%peshkin.net <>
Tue, 10 Dec 2002 22:17:02 +0000 (22:17 +0000)
r=bbaetz
a=justdave

defparams.pl
globals.pl
query.cgi
reports.cgi
request.cgi

index 1e880dd82fb1ce2036805f6ff3f91af3c171acb0..cb02eb986e52a9927ddded0f326fb02f40df8d60 100644 (file)
@@ -261,8 +261,11 @@ sub check_netmask {
 
   {
    name => 'useentrygroupdefault',
-   desc => 'If this is on, Bugzilla will use product bug groups to restrict ' .
-           'who can enter bugs.  Requires makeproductgroups to be on as well.',
+   desc => 'If this is on, Bugzilla will use product bug groups by default ' .
+           'to restrict who can enter bugs. If this is on, users can see ' .
+           'any product to which they have entry access in search menus. ' .
+           'If this is off, users can see any product to which they have not ' .
+           'been excluded by a mandatory restriction.',
    type => 'b',
    default => 0
   },
index 25a949e383935df9eb01af9e41b662f6e5864c03..51d6642fa9332ad0a491fc84b0e2899967aad634 100644 (file)
@@ -774,12 +774,17 @@ sub CanEnterProduct {
 #
 # This function returns an alphabetical list of product names to which
 # the user can enter bugs.
-sub GetEnterableProducts {
+sub GetSelectableProducts {
     my $query = "SELECT name " .
                 "FROM products " .
                 "LEFT JOIN group_control_map " .
-                "ON group_control_map.product_id = products.id " .
-                "AND group_control_map.entry != 0 ";
+                "ON group_control_map.product_id = products.id ";
+    if (Param('useentrygroupdefault')) {
+        $query .= "AND group_control_map.entry != 0 ";
+    } else {
+        $query .= "AND group_control_map.membercontrol = " .
+                  CONTROLMAPMANDATORY . " ";
+    }
     if ((defined @{$::vars->{user}{groupids}}) 
         && (@{$::vars->{user}{groupids}} > 0)) {
         $query .= "AND group_id NOT IN(" . 
@@ -796,19 +801,24 @@ sub GetEnterableProducts {
     return (@products);
 }
 
-# GetEnterableProductHash
+# GetSelectableProductHash
 # returns a hash containing 
 # legal_products => an enterable product list
 # legal_components => the list of components of enterable products
 # components => a hash of component lists for each enterable product
-sub GetEnterableProductHash {
+sub GetSelectableProductHash {
     my $query = "SELECT products.name, components.name " .
                 "FROM products " .
                 "LEFT JOIN components " .
                 "ON components.product_id = products.id " .
                 "LEFT JOIN group_control_map " .
-                "ON group_control_map.product_id = products.id " .
-                "AND group_control_map.entry != 0 ";
+                "ON group_control_map.product_id = products.id ";
+    if (Param('useentrygroupdefault')) {
+        $query .= "AND group_control_map.entry != 0 ";
+    } else {
+        $query .= "AND group_control_map.membercontrol = " .
+                  CONTROLMAPMANDATORY . " ";
+    }
     if ((defined @{$::vars->{user}{groupids}}) 
         && (@{$::vars->{user}{groupids}} > 0)) {
         $query .= "AND group_id NOT IN(" . 
index 680ed05572bc99d65d30f52de45e5b2583d650a0..f6f8c87a5b00f2e027a1d891704e200a90fea31a 100755 (executable)
--- a/query.cgi
+++ b/query.cgi
@@ -198,7 +198,7 @@ my @products = ();
 my %component_set;
 my %version_set;
 my %milestone_set;
-foreach my $p (GetEnterableProducts()) {
+foreach my $p (GetSelectableProducts()) {
     # We build up boolean hashes in the "-set" hashes for each of these things 
     # before making a list because there may be duplicates names across products.
     push @products, $p;
index 05e19990e433ea30f9768335d4941179b3f8ca59..e18d3ee3709e0b9164af801c50f66c56e3b016bb 100755 (executable)
@@ -61,9 +61,7 @@ GetVersionTable();
 # We only want those products that the user has permissions for.
 my @myproducts;
 push( @myproducts, "-All-");
-foreach my $this_product (@legal_product) {
-    push(@myproducts, $this_product) if CanEnterProduct($this_product);
-}
+push( @myproducts, GetSelectableProducts());
 
 if (! defined $FORM{'product'}) {
 
index 920ac79cfdb0c85b38df70545c9222f944defd3b..29c19f27f7f87bf2e7f1c63424469263c6b506c5 100755 (executable)
@@ -254,10 +254,10 @@ sub queue {
     # menu when the products menu changes; used by the template to populate
     # the menus and keep the components menu consistent with the products menu
     GetVersionTable();
-    my $enterable = GetEnterableProductHash();
-    $vars->{'products'} = $enterable->{legal_products};
-    $vars->{'components'} = $enterable->{legal_components};
-    $vars->{'components_by_product'} = $enterable->{components};
+    my $selectable = GetSelectableProductHash();
+    $vars->{'products'} = $selectable->{legal_products};
+    $vars->{'components'} = $selectable->{legal_components};
+    $vars->{'components_by_product'} = $selectable->{components};
     
     $vars->{'excluded_columns'} = \@excluded_columns;
     $vars->{'group_field'} = $::FORM{'group'};