Bug 94437 - Fix Reclassify fieldvaluecontrol interaction
git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@1513 6955db30-a419-402b-8a0d-67ecbb4d7f56master
parent
dc2ebb8194
commit
13114a0097
|
@ -85,11 +85,12 @@ use constant UPDATE_COLUMNS => qw(
|
||||||
maxvotesperbug
|
maxvotesperbug
|
||||||
votestoconfirm
|
votestoconfirm
|
||||||
allows_unconfirmed
|
allows_unconfirmed
|
||||||
|
classification_id
|
||||||
);
|
);
|
||||||
|
|
||||||
use constant VALIDATORS => {
|
use constant VALIDATORS => {
|
||||||
allows_unconfirmed => \&Bugzilla::Object::check_boolean,
|
allows_unconfirmed => \&Bugzilla::Object::check_boolean,
|
||||||
classification => \&_check_classification,
|
classification_id => \&_check_classification_id,
|
||||||
name => \&_check_name,
|
name => \&_check_name,
|
||||||
description => \&_check_description,
|
description => \&_check_description,
|
||||||
version => \&_check_version,
|
version => \&_check_version,
|
||||||
|
@ -497,12 +498,13 @@ sub _check_extproduct
|
||||||
return $product ? $product->id : undef;
|
return $product ? $product->id : undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub _check_classification {
|
sub _check_classification_id {
|
||||||
my ($invocant, $classification_name) = @_;
|
my ($invocant, $classification_name) = @_;
|
||||||
|
|
||||||
my $classification_id = 1;
|
my $classification_id = 1;
|
||||||
if (Bugzilla->params->{'useclassification'}) {
|
if (Bugzilla->params->{'useclassification'}) {
|
||||||
my $classification = Bugzilla::Classification->check($classification_name);
|
my $classification = ref $classification_name ? $classification_name
|
||||||
|
: Bugzilla::Classification->check($classification_name);
|
||||||
$classification_id = $classification->id;
|
$classification_id = $classification->id;
|
||||||
}
|
}
|
||||||
return $classification_id;
|
return $classification_id;
|
||||||
|
@ -686,6 +688,7 @@ sub set_votes_per_user { $_[0]->set('votesperuser', $_[1]); }
|
||||||
sub set_votes_per_bug { $_[0]->set('maxvotesperbug', $_[1]); }
|
sub set_votes_per_bug { $_[0]->set('maxvotesperbug', $_[1]); }
|
||||||
sub set_votes_to_confirm { $_[0]->set('votestoconfirm', $_[1]); }
|
sub set_votes_to_confirm { $_[0]->set('votestoconfirm', $_[1]); }
|
||||||
sub set_allows_unconfirmed { $_[0]->set('allows_unconfirmed', $_[1]); }
|
sub set_allows_unconfirmed { $_[0]->set('allows_unconfirmed', $_[1]); }
|
||||||
|
sub set_classification { $_[0]->set('classification_id', $_[1]); }
|
||||||
|
|
||||||
sub set_extproduct
|
sub set_extproduct
|
||||||
{
|
{
|
||||||
|
|
|
@ -195,16 +195,14 @@ if ($action eq 'update') {
|
||||||
|
|
||||||
if ($action eq 'reclassify') {
|
if ($action eq 'reclassify') {
|
||||||
my $classification = Bugzilla::Classification->check($class_name);
|
my $classification = Bugzilla::Classification->check($class_name);
|
||||||
|
|
||||||
my $sth = $dbh->prepare("UPDATE products SET classification_id = ?
|
|
||||||
WHERE name = ?");
|
|
||||||
|
|
||||||
if (defined $cgi->param('add_products')) {
|
if (defined $cgi->param('add_products')) {
|
||||||
check_token_data($token, 'reclassify_classifications');
|
check_token_data($token, 'reclassify_classifications');
|
||||||
if (defined $cgi->param('prodlist')) {
|
if (defined $cgi->param('prodlist')) {
|
||||||
foreach my $prod ($cgi->param("prodlist")) {
|
foreach my $prod ($cgi->param("prodlist")) {
|
||||||
trick_taint($prod);
|
my $obj = Bugzilla::Product->check($prod);
|
||||||
$sth->execute($classification->id, $prod);
|
$obj->set_classification($classification);
|
||||||
|
$obj->update;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete_token($token);
|
delete_token($token);
|
||||||
|
@ -213,7 +211,9 @@ if ($action eq 'reclassify') {
|
||||||
if (defined $cgi->param('myprodlist')) {
|
if (defined $cgi->param('myprodlist')) {
|
||||||
foreach my $prod ($cgi->param("myprodlist")) {
|
foreach my $prod ($cgi->param("myprodlist")) {
|
||||||
trick_taint($prod);
|
trick_taint($prod);
|
||||||
$sth->execute(1,$prod);
|
my $obj = Bugzilla::Product->check($prod);
|
||||||
|
$obj->set_classification('Unclassified');
|
||||||
|
$obj->update;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete_token($token);
|
delete_token($token);
|
||||||
|
|
Loading…
Reference in New Issue