Better 'makeproductgroups' handling.

* Do not insert group into all products by default when 'makeproductgroups' is on
* Allow to choose whether to create access group for new products
* Move group and series creation calls away from Product->create
* Change help text
* Enable makeproductgroups by default again
hinted-selects
Vitaliy Filippov 2014-10-07 15:53:00 +04:00
parent 6574c7af78
commit 4479f5a97b
6 changed files with 41 additions and 35 deletions

View File

@ -45,7 +45,7 @@ sub get_param_list {
{
name => 'makeproductgroups',
type => 'b',
default => 0
default => 1
},
{

View File

@ -83,7 +83,6 @@ use constant VALIDATORS => {
votesperuser => \&_check_votes_per_user,
maxvotesperbug => \&_check_votes_per_bug,
votestoconfirm => \&_check_votes_to_confirm,
create_series => \&Bugzilla::Object::check_boolean,
notimetracking => \&Bugzilla::Object::check_boolean,
extproduct => \&_check_extproduct,
# CustIS Bug 38616 - CC list restriction
@ -111,7 +110,6 @@ sub create
$params->{classification_id} = delete $params->{classification};
}
my $version = delete $params->{version};
my $create_series = delete $params->{create_series};
my $field_values = $class->run_create_validators($params);
my $product = $class->insert_create_data($field_values);
@ -129,10 +127,6 @@ sub create
# Fill visibility values
$product->set_visibility_values([ $product->classification_id ]);
# Create groups and series for the new product, if requested.
$product->_create_bug_group() if Bugzilla->params->{makeproductgroups};
$product->_create_series() if $create_series;
Bugzilla::Hook::process('product_end_of_create', { product => $product });
Bugzilla->get_field(FIELD_NAME)->touch;

View File

@ -213,7 +213,7 @@ if ($action eq 'new') {
isbuggroup => 1,
});
# Permit all existing products to use the new group if makeproductgroups.
# Permit all existing products to use the new group.
if ($cgi->param('insertnew')) {
$dbh->do('INSERT INTO group_control_map
(group_id, product_id, membercontrol, othercontrol)

View File

@ -178,7 +178,6 @@ if ($action eq 'new')
entryheaderhtml => scalar $cgi->param('entryheaderhtml'),
version => scalar $cgi->param('version'),
isactive => scalar $cgi->param('is_active'),
create_series => scalar $cgi->param('createseries'),
allows_unconfirmed => scalar $cgi->param('allows_unconfirmed'),
wiki_url => scalar $cgi->param('wiki_url'),
notimetracking => scalar $cgi->param('notimetracking'),
@ -193,6 +192,10 @@ if ($action eq 'new')
}
my $product = Bugzilla::Product->create(\%create_params);
# Create groups and series for the new product, if requested.
$product->_create_bug_group() if scalar $cgi->param('makeproductgroup');
$product->_create_series() if scalar $cgi->param('createseries');
delete_token($token);
$vars->{message} = 'product_created';

View File

@ -32,16 +32,18 @@
%]
<form method="post" action="editgroups.cgi">
<table border="1" cellpadding="4" cellspacing="0"><tr>
<table border="1" cellpadding="4" cellspacing="0">
<tr>
<th>New Name</th>
<th>New Description</th>
<th>New User RegExp</th>
<th>Use For [% terms.Bugs %]</th>
</tr><tr>
<td><input size="20" name="name"></td>
<td><input size="40" name="desc"></td>
<td><input size="30" name="regexp"></td>
<td><input type="checkbox" name="isactive" value="1" checked></td>
</tr>
<tr>
<td><input size="20" name="name" /></td>
<td><input size="40" name="desc" /></td>
<td><input size="30" name="regexp" /></td>
<td><input type="checkbox" name="isactive" value="1" checked="checked" /></td>
</tr>
<tr>
<th>Icon URL:</th>
@ -50,21 +52,19 @@
[% Hook.process('field') %]
</table>
<hr>
<hr />
<input type="checkbox" id="insertnew" name="insertnew" value="1"
[% IF Param("makeproductgroups") %] checked[% END %]>
<label for="insertnew">Insert new group into all existing products.</label>
<input type="checkbox" id="insertnew" name="insertnew" value="1" />
<label for="insertnew">Associate new group with ALL existing products</label>
<p>
<input type="submit" id="create" value="Add">
<input type="hidden" name="action" value="new">
<input type="hidden" name="token" value="[% token FILTER html %]">
<input type="submit" id="create" value="Add" />
<input type="hidden" name="action" value="new" />
<input type="hidden" name="token" value="[% token FILTER html %]">
</p>
</form>
<p><b>Name</b> is what is used with the B<!-- blah -->ugzilla->user->in_group()
function in any customized cgi files you write that use a given group.
It can also be used by people submitting [% terms.bugs %] by email to
limit [% terms.abug %] to a certain set of groups.</p>
<p><b>Name</b> is the group name displayed for users when
limitting [% terms.bugs %] to a certain set of groups.</p>
<p><b>Description</b> is what will be shown in the [% terms.bug %] reports
to members of the group where they can choose whether
@ -79,8 +79,8 @@ than deleting the group would be. <b>Note: If you are creating
a group, you probably want it to be usable for [% terms.bugs %], in which
case you should leave this checked.</b></p>
<p><b>User RegExp</b> is optional, and if filled in, will
automatically grant membership to this group to anyone with an
<p><b>User RegExp</b> is optional, and if filled in, will
automatically grant membership to this group to anyone with an
email address that matches this regular expression.</p>
<p>
@ -90,13 +90,13 @@ email address that matches this regular expression.</p>
in comments in [% terms.bugs %] besides the name of the author of comments.
</p>
<p>By default, the new group will be associated with existing
products. Unchecking the "Insert new group into all existing
products" option will prevent this and make the group become
visible only when its controls have been added to a product.</p>
<p>If you select "Associate new group with ALL existing products",
new group will be added as optional (SHOWN/NA) into ALL existing products,
so any member of this group will be able to decide whether to restrict
bug access in ANY product by this group.</p>
<p>Back to the <a href="./">main [% terms.bugs %] page</a>
or to the <a href="editgroups.cgi">group list</a>.
[% PROCESS global/footer.html.tmpl %]
[% PROCESS global/footer.html.tmpl %]

View File

@ -46,8 +46,17 @@
</td>
</tr>
<tr>
<th align="left">Create chart datasets:</th>
<td><input type="checkbox" name="createseries" value="1"></td>
<td colspan="2">
<input type="checkbox" name="createseries" id="createseries" value="1" />
<b><label for="createseries">Create chart datasets for this product</label></b>
</td>
</tr>
<tr>
<td colspan="2">
<input type="checkbox" id="makeproductgroup" name="makeproductgroup" value="1"
[% ' checked' IF Param('makeproductgroups') %] />
<b><label for="makeproductgroup">Create access group for this product</label></b>
</td>
</tr>
</table>