Allow to move products between classifications from product page
parent
31d01f7524
commit
b0964e90c1
|
@ -569,6 +569,7 @@ sub _check_classification_id
|
|||
: Bugzilla::Classification->check($classification_name);
|
||||
$classification_id = $classification->id;
|
||||
}
|
||||
delete $invocant->{classification_obj} if ref $invocant;
|
||||
return $classification_id;
|
||||
}
|
||||
|
||||
|
|
|
@ -138,6 +138,7 @@ if ($action eq 'add') {
|
|||
if (Bugzilla->params->{'useclassification'}) {
|
||||
my $classification = Bugzilla::Classification->check($classification_name);
|
||||
$vars->{'classification'} = $classification;
|
||||
$vars->{'classifications'} = [ Bugzilla::Classification->get_all ];
|
||||
}
|
||||
$vars->{'token'} = issue_session_token('add_product');
|
||||
$vars->{all_groups} = [ map { $_->name } Bugzilla::Group->get_all ];
|
||||
|
@ -260,7 +261,8 @@ if ($action eq 'edit' || (!$action && $product_name)) {
|
|||
my $product = $user->check_can_admin_product($product_name);
|
||||
|
||||
if (Bugzilla->params->{'useclassification'}) {
|
||||
$vars->{'classification'} = new Bugzilla::Classification($product->classification_id);
|
||||
$vars->{'classification'} = $product->classification_obj;
|
||||
$vars->{'classifications'} = [ Bugzilla::Classification->get_all ];
|
||||
}
|
||||
$vars->{'product'} = $product;
|
||||
$vars->{'token'} = issue_session_token('edit_product');
|
||||
|
@ -288,6 +290,10 @@ if ($action eq 'update') {
|
|||
my $product_old_name = trim($cgi->param('product_old_name') || '');
|
||||
my $product = $user->check_can_admin_product($product_old_name);
|
||||
|
||||
if (Bugzilla->params->{useclassification}) {
|
||||
$vars->{old_classification} = $product->classification_obj;
|
||||
$product->set_classification(scalar $cgi->param('classification'));
|
||||
}
|
||||
$product->set_name($product_name);
|
||||
$product->set_wiki_url(scalar $cgi->param('wiki_url'));
|
||||
$product->set_notimetracking(scalar $cgi->param('notimetracking'));
|
||||
|
@ -308,7 +314,7 @@ if ($action eq 'update') {
|
|||
delete_token($token);
|
||||
|
||||
if (Bugzilla->params->{'useclassification'}) {
|
||||
$vars->{'classification'} = new Bugzilla::Classification($product->classification_id);
|
||||
$vars->{'classification'} = $product->classification_obj;
|
||||
}
|
||||
$vars->{'product'} = $product;
|
||||
$vars->{unconfirmed_states} = [ map { $_->name } grep { !$_->is_confirmed } Bugzilla::Status->get_all ];
|
||||
|
|
|
@ -54,7 +54,6 @@
|
|||
<input type="submit" value="Add" />
|
||||
<input type="hidden" name="action" value="new" />
|
||||
<input type="hidden" name="token" value="[% token | html %]" />
|
||||
<input type="hidden" name="classification" value="[% classification.name | html %]" />
|
||||
</form>
|
||||
|
||||
[% PROCESS "admin/products/footer.html.tmpl"
|
||||
|
|
|
@ -24,7 +24,11 @@
|
|||
[% IF Param('useclassification') %]
|
||||
<tr>
|
||||
<th align="left"><b>Classification:</b></th>
|
||||
<td><b>[% classification.name | html %]</b></td>
|
||||
<td><select name="classification">
|
||||
[% FOR c = classifications %]
|
||||
<option value="[% c.name | html %]" [% "selected" IF classification.id == c.id %]>[% c.name | html %]</option>
|
||||
[% END %]
|
||||
</select></td>
|
||||
</tr>
|
||||
[% END %]
|
||||
|
||||
|
|
|
@ -47,6 +47,11 @@
|
|||
</p>
|
||||
[% END %]
|
||||
|
||||
[% IF changes.classification_id.defined %]
|
||||
<p>
|
||||
Product moved from classification '[% old_classification.name | html %]' to '[% classification.name | html %]'.
|
||||
</p>
|
||||
[% END %]
|
||||
|
||||
[% IF changes.description.defined %]
|
||||
<p>
|
||||
|
|
Loading…
Reference in New Issue